rockbox/apps/plugins
Michael Giacomelli e430ecb607 imageviewer/jpegp: don't crash or hang on damaged files
On colour targets the image viewer hands every file its own decoder
rejects to jpegp, including damaged ones, but jpegp barely checks its
input. Corrupt and truncated files crashed or hung it:

- At the end of the file GETC() kept returning stale bytes, so marker
  searches and table reads never ended. Feed EOI markers (FF D9)
  instead, which ends every loop, and stop calling read() there. This
  state is reset in OPEN(): the overlay loader does not clear .bss.
- A file ending before any scan decoded as a blank image. Report it as
  corrupt instead.
- Out of range header values were used as array indexes: Huffman and
  conditioning table IDs, Huffman table sizes, sampling factors, scan
  component counts and spectral selection. Reject them, and frames of
  zero width or with no components.
- Invalid Huffman codes walked past the code length table, run lengths
  wrote past coefficient 63, and huge coefficients indexed past the
  IDCT clamp table. Bound all three.
- An odd DAC segment length never ended its loop.
- The coefficient buffer size could overflow an int.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Change-Id: I49465f38d283e159274d2f381029280cea42a8f1
2026-10-03 08:01:44 -04:00
..
bitmaps plugins: 400x240 landscape screens 2026-10-02 10:30:58 +02:00
chessbox 3ds: Port refactor. 2026-09-01 08:39:07 -04:00
clock Add "rbfs" prefix to native filesystem functions 2026-09-17 16:22:31 -04:00
doom Add "rbfs" prefix to native filesystem functions 2026-09-17 16:22:31 -04:00
fft plugins/fft: do not starve other threads 2026-08-05 16:18:03 -04:00
fractals 3ds: Port refactor. 2026-09-01 08:39:07 -04:00
frotz chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
goban 3ds: Port refactor. 2026-09-01 08:39:07 -04:00
h264_player hw_h264: remove redundant ifdef guards 2026-09-23 16:22:18 +01:00
imageviewer imageviewer/jpegp: don't crash or hang on damaged files 2026-10-03 08:01:44 -04:00
lib Fix build errors in 3a57f2f721 2026-09-17 21:42:16 +01:00
lua misc: forums.rockbox.org -> www.rockbox.org/forums 2026-09-27 10:46:01 -04:00
lua_scripts filebrowse.lua add sort by type, add .bmp, .mod to known filetypes 2026-08-07 09:05:59 -04:00
midi 3ds: Port refactor. 2026-09-01 08:39:07 -04:00
mikmod Add "rbfs" prefix to native filesystem functions 2026-09-17 16:22:31 -04:00
mpegplayer Add "rbfs" prefix to native filesystem functions 2026-09-17 16:22:31 -04:00
pacbox pacbox: Add missing function annotation to arm asm functions 2026-09-19 21:23:48 -04:00
pdbox Add "rbfs" prefix to native filesystem functions 2026-09-17 16:22:31 -04:00
picross chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
pictureflow Add "rbfs" prefix to native filesystem functions 2026-09-17 16:22:31 -04:00
puzzles chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
reversi 3ds: Port refactor. 2026-09-01 08:39:07 -04:00
rockboy Add "rbfs" prefix to native filesystem functions 2026-09-17 16:22:31 -04:00
sdl 3ds: Port refactor. 2026-09-01 08:39:07 -04:00
searchengine chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
shortcuts chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
sudoku plugins: 400x240 landscape screens 2026-10-02 10:30:58 +02:00
tagcache Add "rbfs" prefix to native filesystem functions 2026-09-17 16:22:31 -04:00
text_viewer Add "rbfs" prefix to native filesystem functions 2026-09-17 16:22:31 -04:00
xrick chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
xworld chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
zxbox 3ds: Port refactor. 2026-09-01 08:39:07 -04:00
2048.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
alarmclock.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
amaze.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
announce_status.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
battery_bench.c 3ds: Port refactor. 2026-09-01 08:39:07 -04:00
bench_mem_jpeg.c Add "rbfs" prefix to native filesystem functions 2026-09-17 16:22:31 -04:00
bench_scaler.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
blackjack.c 3ds: Port refactor. 2026-09-01 08:39:07 -04:00
boomshine.lua chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
bounce.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
brickmania.c 3ds: Port refactor. 2026-09-01 08:39:07 -04:00
bubbles.c plugins: 400x240 landscape screens 2026-10-02 10:30:58 +02:00
BUILD_OVERLAY
calculator.c 3ds: Port refactor. 2026-09-01 08:39:07 -04:00
calendar.c 3ds: Port refactor. 2026-09-01 08:39:07 -04:00
CATEGORIES plugins: add timer/countdown plugin 2026-04-16 21:35:52 -04:00
chessbox.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
chessclock.c 3ds: Port refactor. 2026-09-01 08:39:07 -04:00
chip8.c 3ds: Port refactor. 2026-09-01 08:39:07 -04:00
chopper.c 3ds: Port refactor. 2026-09-01 08:39:07 -04:00
clix.c 3ds: Port refactor. 2026-09-01 08:39:07 -04:00
codebuster.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
countdown_timer.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
credits.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
credits.pl chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
crypt_firmware.c Add "rbfs" prefix to native filesystem functions 2026-09-17 16:22:31 -04:00
cube.c 3ds: Port refactor. 2026-09-01 08:39:07 -04:00
cue_playlist.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
dart_scorer.c dart_scorer: scale better on smaller devices 2026-05-06 13:20:48 -04:00
db_folder_select.c plugins: db_folder_select, disktidy, main_menu_config: Fix selection dialog with Show Icons set to No 2025-04-10 12:30:29 +03:00
demystify.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
dice.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
dict.c Add "rbfs" prefix to native filesystem functions 2026-09-17 16:22:31 -04:00
disktidy.c disktidy: fix blank "Last Run" screen in some themes 2026-09-05 19:31:28 -04:00
disktidy.config disktidy: Add '__MACOSX' directories to the list 2026-04-01 10:32:40 -04:00
duke3d.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
elfdep.pl
file_picker.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
fire.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
fireworks.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
flipit.c 3ds: Port refactor. 2026-09-01 08:39:07 -04:00
goban.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
greyscale.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
helloworld.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
helloworld.lua chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
invadrox.c plugins: 400x240 landscape screens 2026-10-02 10:30:58 +02:00
iriver_flash.c firmware: move iriver flash helper functions into target tree 2026-09-23 13:44:45 -04:00
iriverify.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
jackpot.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
jewels.c 3ds: Port refactor. 2026-09-01 08:39:07 -04:00
keybox.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
keyremap.c Add "rbfs" prefix to native filesystem functions 2026-09-17 16:22:31 -04:00
lamp.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
lastfm_scrobbler.c lastfm_scrobbler: don't include rbversion.h 2026-09-03 16:49:08 +01:00
lastfm_scrobbler_viewer.c Add "rbfs" prefix to native filesystem functions 2026-09-17 16:22:31 -04:00
logo.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
lrcplayer.c Add "rbfs" prefix to native filesystem functions 2026-09-17 16:22:31 -04:00
main_menu_config.c Use user preferred touchscreen mode in 'Main Menu Config' plugin instead of defaulting to 'button' mode. 2026-01-03 20:25:13 -05:00
matrix.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
maze.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
mazezam.c plugins & debug menu: apply consistent titles 2025-12-23 10:25:05 -05:00
md5sum.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
metronome.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
minesweeper.c 3ds: Port refactor. 2026-09-01 08:39:07 -04:00
mosaique.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
mp3_encoder.c Add "rbfs" prefix to native filesystem functions 2026-09-17 16:22:31 -04:00
multiboot_select.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
open_plugins.c Add "rbfs" prefix to native filesystem functions 2026-09-17 16:22:31 -04:00
oscilloscope.c 3ds: Port refactor. 2026-09-01 08:39:07 -04:00
otp.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
pegbox.c 3ds: Port refactor. 2026-09-01 08:39:07 -04:00
periodic_table.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
picross.lua Allow first level folders in plugin menu 2024-05-05 14:01:43 -04:00
pictureflow.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
pitch_detector.c Fix build errors in 3a57f2f721 2026-09-17 21:42:16 +01:00
pitch_screen.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
pixel-painter.lua misc: forums.rockbox.org -> www.rockbox.org/forums 2026-09-27 10:46:01 -04:00
plasma.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
playing_time.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
plugin.lds ovl_offset: use elf symbols instead of refmap 2026-05-27 17:55:33 -04:00
plugin_crt0.c 3ds: Port refactor. 2026-09-01 08:39:07 -04:00
plugins.make chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
pong.c 3ds: Port refactor. 2026-09-01 08:39:07 -04:00
properties.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
quake.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
random_folder_advance_config.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
rb_info.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
remote_control.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
resistor.c plugins & debug menu: apply consistent titles 2025-12-23 10:25:05 -05:00
robotfindskitten.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
rockblox.c plugins: 400x240 landscape screens 2026-10-02 10:30:58 +02:00
rockblox1d.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
rockbox-fonts.config FS#9059: Add WenQangYi Unibt font (William Poetra Yoga Hadisoeseno) 2024-10-27 22:04:54 -04:00
rockboy.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
rocklife.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
rockpaint.c 3ds: Port refactor. 2026-09-01 08:39:07 -04:00
search.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
settings_dumper.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
shopper.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
sliding_puzzle.c 3ds: Port refactor. 2026-09-01 08:39:07 -04:00
snake.c 3ds: Port refactor. 2026-09-01 08:39:07 -04:00
snake2.c 3ds: Port refactor. 2026-09-01 08:39:07 -04:00
snake2.levels
snow.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
sokoban.c 3ds: Port refactor. 2026-09-01 08:39:07 -04:00
sokoban.levels
solitaire.c 3ds: Port refactor. 2026-09-01 08:39:07 -04:00
sort.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
SOURCES plugins: add timer/countdown plugin 2026-04-16 21:35:52 -04:00
SOURCES.app_build ap80max: New hosted port 2026-08-13 17:55:06 -07:00
spacerocks.c 3ds: Port refactor. 2026-09-01 08:39:07 -04:00
speedread.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
star.c 3ds: Port refactor. 2026-09-01 08:39:07 -04:00
starfield.c plugins: starfield: enable USB audio 2025-12-15 07:48:45 -05:00
stats.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
stopwatch.c 3ds: Port refactor. 2026-09-01 08:39:07 -04:00
stopwatch.lua chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
SUBDIRS ipod6g: add hardware H.264 video playback 2026-09-13 08:07:59 -04:00
SUBDIRS.app_build ap80max: New hosted port 2026-08-13 17:55:06 -07:00
superdom.c plugins: 400x240 landscape screens 2026-10-02 10:30:58 +02:00
test_boost.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
test_codec.c Add "rbfs" prefix to native filesystem functions 2026-09-17 16:22:31 -04:00
test_core_jpeg.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
test_disk.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
test_fps.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
test_gfx.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
test_grey.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
test_greylib_bitmap_scale.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
test_kbd.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
test_mem.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
test_mem_jpeg.c Add "rbfs" prefix to native filesystem functions 2026-09-17 16:22:31 -04:00
test_resize.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
test_sampr.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
test_scanrate.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
test_touchscreen.c ap80max: New hosted port 2026-08-13 17:55:06 -07:00
test_usb.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
test_viewports.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
test_viewports.lua chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
text_editor.c Add "rbfs" prefix to native filesystem functions 2026-09-17 16:22:31 -04:00
theme_remove.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
vbrfix.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
view_text.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
viewers.config ipod6g: add hardware H.264 video playback 2026-09-13 08:07:59 -04:00
vu_meter.c 3ds: Port refactor. 2026-09-01 08:39:07 -04:00
wav2wv.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
wavview.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
windows_lnk.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
wolf3d.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
wormlet.c plugins: 400x240 landscape screens 2026-10-02 10:30:58 +02:00
xobox.c 3ds: Port refactor. 2026-09-01 08:39:07 -04:00
zxbox.c