summaryrefslogtreecommitdiff
path: root/apps/recorder/jpeg_load.c
diff options
context:
space:
mode:
authorMichael Giacomelli <giac2000@hotmail.com>2020-12-09 01:05:48 -0500
committerMichael Giacomelli <giac2000@hotmail.com>2020-12-14 04:14:45 +0000
commit64cc9aad73fd8f5e780be46806f85473e261862f (patch)
tree4c04c5a800255e9e78c6ce63bbd2ab5136b90c05 /apps/recorder/jpeg_load.c
parent56f4ec96686521d2b267d55271b0f5483c96bf6c (diff)
downloadrockbox-64cc9aad73fd8f5e780be46806f85473e261862f.tar.gz
rockbox-64cc9aad73fd8f5e780be46806f85473e261862f.zip
Do not resize images greater than 32767 pixels in either dimension
Internally, the resizing code uses the rockbox dim structure, which uses signed shorts. Change-Id: Ic8850e8563a9d8c0cb3cf8269e2576be9e42b45b
Diffstat (limited to 'apps/recorder/jpeg_load.c')
-rwxr-xr-x[-rw-r--r--]apps/recorder/jpeg_load.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/apps/recorder/jpeg_load.c b/apps/recorder/jpeg_load.c
index 16a2f4e3a3..9ab42b7a9f 100644..100755
--- a/apps/recorder/jpeg_load.c
+++ b/apps/recorder/jpeg_load.c
@@ -2050,6 +2050,15 @@ int clip_jpeg_fd(int fd,
2050 if (!(status & DHT)) /* if no Huffman table present: */ 2050 if (!(status & DHT)) /* if no Huffman table present: */
2051 default_huff_tbl(p_jpeg); /* use default */ 2051 default_huff_tbl(p_jpeg); /* use default */
2052 fix_headers(p_jpeg); /* derive Huffman and other lookup-tables */ 2052 fix_headers(p_jpeg); /* derive Huffman and other lookup-tables */
2053
2054 /*the dim array in rockbox is limited to 2^15-1 pixels, so we cannot resize
2055 images larger than this without overflowing */
2056 if(p_jpeg->x_size > 32767 || p_jpeg->y_size > 32767)
2057 {
2058 JDEBUGF("Aborting resize of image > 32767 pixels\n");
2059 return -1;
2060 }
2061
2053 src_dim.width = p_jpeg->x_size; 2062 src_dim.width = p_jpeg->x_size;
2054 src_dim.height = p_jpeg->y_size; 2063 src_dim.height = p_jpeg->y_size;
2055 if (format & FORMAT_RESIZE) 2064 if (format & FORMAT_RESIZE)