summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2020-04-05 00:28:33 -0400
committerSolomon Peachy <pizza@shaftnet.org>2020-04-05 06:34:21 +0200
commitc0ebbd4ccb00df33828dd8b4ef79a172c3a51169 (patch)
treeb539afc88782b6f8c0dc779880112d1ef364c487
parent191ffe272b8fb81924814b95504313a5d9f63526 (diff)
downloadrockbox-c0ebbd4ccb.tar.gz
rockbox-c0ebbd4ccb.tar.bz2
rockbox-c0ebbd4ccb.zip
jpeg: Fix an overflow when decoding images for non-color targets.
(Warning raised by GCC 4.9.4 -Os) Change-Id: I1d2f491c8bdb11fe89ffb119e248ca0f4eb69de2
-rw-r--r--apps/recorder/jpeg_load.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/apps/recorder/jpeg_load.c b/apps/recorder/jpeg_load.c
index e326d1c18a..61ec3bfa0e 100644
--- a/apps/recorder/jpeg_load.c
+++ b/apps/recorder/jpeg_load.c
@@ -1541,7 +1541,14 @@ INLINE void fix_huff_tables(struct jpeg *p_jpeg)
INLINE void fix_quant_tables(struct jpeg *p_jpeg)
{
int shift, i, j;
- for (i = 0; i < 2; i++)
+
+#ifdef HAVE_LCD_COLOR
+ const int k = 2;
+#else
+ const int k = 1;
+#endif
+
+ for (i = 0; i < k; i++)
{
shift = idct_tbl[p_jpeg->v_scale[i]].scale;
if (shift)