From 58328fa2b0a22a6d266d89ae1b3e7a717b4ca45d Mon Sep 17 00:00:00 2001 From: Sebastien Ronsse Date: Wed, 25 May 2016 15:57:01 +1000 Subject: [PATCH] rjpeg: Fix invalid read/writes during JPEG RGBA to ARGB conversion --- libretro-common/formats/jpeg/rjpeg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libretro-common/formats/jpeg/rjpeg.c b/libretro-common/formats/jpeg/rjpeg.c index e747d29afc..1b1c0803dc 100644 --- a/libretro-common/formats/jpeg/rjpeg.c +++ b/libretro-common/formats/jpeg/rjpeg.c @@ -2529,7 +2529,7 @@ int rjpeg_process_image(rjpeg_t *rjpeg, void **buf_data, *buf_data = pixels; /* Convert RGBA to ARGB */ - do + while (size_tex--) { unsigned int texel = img[size_tex]; unsigned int A = texel & 0xFF000000; @@ -2537,7 +2537,7 @@ int rjpeg_process_image(rjpeg_t *rjpeg, void **buf_data, unsigned int G = texel & 0x0000FF00; unsigned int R = texel & 0x000000FF; ((unsigned int*)pixels)[size_tex] = A | (R << 16) | G | (B >> 16); - }while(size_tex--); + }; free(img);