From: Nick Bowler Date: Fri, 11 May 2012 23:39:36 +0000 (-0400) Subject: engine: Fix off-by-one in PCX run-length encoder. X-Git-Url: http://git.draconx.ca/gitweb/upkg.git/commitdiff_plain/bd129e23c58d0d56f3c587a3c06c52de43ad908c engine: Fix off-by-one in PCX run-length encoder. Runs of 64 bytes are invalid, but the encoder would emit them anyway (which get subsequently interpreted as a run of 0). This obviously causes some textures to export incorrectly. We can now export all of UTtech2.utx! --- diff --git a/src/engine/pcx.c b/src/engine/pcx.c index b01e9b8..f0d0ba5 100644 --- a/src/engine/pcx.c +++ b/src/engine/pcx.c @@ -68,7 +68,7 @@ int pcx_write_scanline(const struct pcx_head *head, const unsigned char *src, for (size_t i = 0; i < len;) { unsigned run = 0; - while (i+run < len && src[i] == src[i+run] && run <= 0x3f) + while (i+run < len && src[i] == src[i+run] && run < 0x3f) run++; if (run > 1 || src[i] > 0xbf)