From 18910607826071538e97c2401382726bd776e618 Mon Sep 17 00:00:00 2001 From: Sean Barrett Date: Sun, 29 Jan 2023 06:17:45 -0800 Subject: [PATCH] a fix --- stb_image.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/stb_image.h b/stb_image.h index d60371b..1e6d519 100644 --- a/stb_image.h +++ b/stb_image.h @@ -1,4 +1,4 @@ -/* stb_image - v2.27 - public domain image loader - http://nothings.org/stb +/* stb_image - v2.27x - public domain image loader - http://nothings.org/stb no warranty implied; use at your own risk Do this: @@ -3377,15 +3377,19 @@ static int stbi__decode_jpeg_image(stbi__jpeg *j) } // if we reach eof without hitting a marker, stbi__get_marker() below will fail and we'll eventually return 0 } + m = stbi__get_marker(j); + if (STBI__RESTART(m)) + m = stbi__get_marker(j); } else if (stbi__DNL(m)) { int Ld = stbi__get16be(j->s); stbi__uint32 NL = stbi__get16be(j->s); if (Ld != 4) return stbi__err("bad DNL len", "Corrupt JPEG"); if (NL != j->s->img_y) return stbi__err("bad DNL height", "Corrupt JPEG"); + m = stbi__get_marker(j); } else { - if (!stbi__process_marker(j, m)) return 0; + if (!stbi__process_marker(j, m)) return 1; + m = stbi__get_marker(j); } - m = stbi__get_marker(j); } if (j->progressive) stbi__jpeg_finish(j);