From bd129e23c58d0d56f3c587a3c06c52de43ad908c Mon Sep 17 00:00:00 2001 From: Nick Bowler Date: Fri, 11 May 2012 19:39:36 -0400 Subject: [PATCH] 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! --- src/engine/pcx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) -- 2.43.0