FS#13748 - The imageviewer plugin decodes the file infinitely when opening a empty JPEG file.

rockbox-gerrit-noreply--- via rockbox-cvs <[email protected]>
Newsgroups gmane.comp.systems.archos.rockbox.cvs
Message-ID <[email protected]>
commit 3c6b9bb45892a00cde3f0603e78cde1b39c4bfe0
Author: William Wilgus <[email protected]>
Date:   Thu Jan 22 23:59:00 2026 -0500

    FS#13748 - The imageviewer plugin decodes the file infinitely when opening a empty JPEG file.
    
    Couldn't reproduce this on most of my devices or the sims
    turns out the bug depends on uninitialized memory being FF
    and the file empty
    
    Uninitialized memory fixed what I saw at least..
    
    Change-Id: Ie267af0a20685003ee28ff42d008dd7942a7c6fc

diff --git a/apps/plugins/imageviewer/jpegp/BUFFILEGETC.c b/apps/plugins/imageviewer/jpegp/BUFFILEGETC.c
index 5124636731..a833851b1b 100644
--- a/apps/plugins/imageviewer/jpegp/BUFFILEGETC.c
+++ b/apps/plugins/imageviewer/jpegp/BUFFILEGETC.c
@@ -74,6 +74,7 @@ extern int TELL(void)
 
 extern void *OPEN(char *f)
 {
+    memset(buff, 0, sizeof(buff));
     printf("Opening %s\n", f);
     cur_buff_pos = length = file_pos = 0;
     fd = rb->open(f,O_RDONLY);
diff --git a/apps/plugins/imageviewer/jpegp/FILEGETC.c b/apps/plugins/imageviewer/jpegp/FILEGETC.c
index bb7f0c485f..5b03deb25c 100644
--- a/apps/plugins/imageviewer/jpegp/FILEGETC.c
+++ b/apps/plugins/imageviewer/jpegp/FILEGETC.c
@@ -4,8 +4,8 @@ static int fd;
 
 extern int GETC(void)
 {
-    unsigned char x;
-    rb->read(fd, &x, 1);
+    unsigned char x = 0;
+    rb->read(fd, &x, 1)
     return x;
 }
 
-- 
rockbox-cvs mailing list
[email protected]
https://lists.haxx.se/mailman/listinfo/rockbox-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.