We skip jpeg data during decoding using imageio_skip_input_data() in both src/java.desktop/share/native/libjavajpeg/imageioJPEG.c and src/java.desktop/share/native/libjavajpeg/jpegdecoder.c
We update num_bytes with sb->remaining_skip in these functions and it can overflow. We need to add additional check for num_bytes here. With updated code ran all awt and imageio tests in CI and it is green. ------------- Commit messages: - 8318951: Additional negative value check in JPEG decoding Changes: https://git.openjdk.org/jdk/pull/16390/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=16390&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8318951 Stats: 8 lines in 2 files changed: 8 ins; 0 del; 0 mod Patch: https://git.openjdk.org/jdk/pull/16390.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/16390/head:pull/16390 PR: https://git.openjdk.org/jdk/pull/16390
