From 17bc84e15dfb7c5c7ebcc5246e929678478b15a4 Mon Sep 17 00:00:00 2001 From: Fabian Giesen Date: Sun, 4 Jul 2021 21:47:13 -0700 Subject: [PATCH] stb_image: stbi__bmp_info only rewind stream on error To be consistent with the other info functions. Fixes issue #892. --- stb_image.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/stb_image.h b/stb_image.h index e68580f..32d5e88 100644 --- a/stb_image.h +++ b/stb_image.h @@ -7205,9 +7205,10 @@ static int stbi__bmp_info(stbi__context *s, int *x, int *y, int *comp) info.all_a = 255; p = stbi__bmp_parse_header(s, &info); - stbi__rewind( s ); - if (p == NULL) + if (p == NULL) { + stbi__rewind( s ); return 0; + } if (x) *x = s->img_x; if (y) *y = s->img_y; if (comp) {