mirror of
https://github.com/JetBrains/JetBrainsRuntime.git
synced 2025-12-06 09:29:38 +01:00
8318951: Additional negative value check in JPEG decoding
Backport-of: 75ce02fe74
This commit is contained in:
committed by
Vitaly Provodin
parent
4161de1dbc
commit
ab4df04dfb
@@ -1132,6 +1132,10 @@ imageio_skip_input_data(j_decompress_ptr cinfo, long num_bytes)
|
||||
return;
|
||||
}
|
||||
num_bytes += sb->remaining_skip;
|
||||
// Check for overflow if remaining_skip value is too large
|
||||
if (num_bytes < 0) {
|
||||
return;
|
||||
}
|
||||
sb->remaining_skip = 0;
|
||||
|
||||
/* First the easy case where we are skipping <= the current contents. */
|
||||
|
||||
@@ -406,6 +406,10 @@ sun_jpeg_skip_input_data(j_decompress_ptr cinfo, long num_bytes)
|
||||
return;
|
||||
}
|
||||
num_bytes += src->remaining_skip;
|
||||
// Check for overflow if remaining_skip value is too large
|
||||
if (num_bytes < 0) {
|
||||
return;
|
||||
}
|
||||
src->remaining_skip = 0;
|
||||
ret = (int)src->pub.bytes_in_buffer; /* this conversion is safe, because capacity of the buffer is limited by jnit */
|
||||
if (ret >= num_bytes) {
|
||||
|
||||
Reference in New Issue
Block a user