Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integer Overflow at j2k.c:11114 #1491

Merged
merged 1 commit into from
Dec 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix j2k.c:11114
  • Loading branch information
headshog authored and rouault committed Dec 8, 2023
commit 67e6a79bcf6b2ea5503f47954537d14ed37e4a72
8 changes: 8 additions & 0 deletions src/lib/openjp2/j2k.c
Original file line number Diff line number Diff line change
Expand Up @@ -11101,6 +11101,10 @@ static OPJ_BOOL opj_j2k_read_SQcd_SQcc(opj_j2k_t *p_j2k,
l_tccp->stepsizes[l_band_no].mant = 0;
}
}

if (*p_header_size < l_num_band) {
return OPJ_FALSE;
}
*p_header_size = *p_header_size - l_num_band;
} else {
for (l_band_no = 0; l_band_no < l_num_band; l_band_no++) {
Expand All @@ -11111,6 +11115,10 @@ static OPJ_BOOL opj_j2k_read_SQcd_SQcc(opj_j2k_t *p_j2k,
l_tccp->stepsizes[l_band_no].mant = l_tmp & 0x7ff;
}
}

if (*p_header_size < 2 * l_num_band) {
return OPJ_FALSE;
}
*p_header_size = *p_header_size - 2 * l_num_band;
}

Expand Down
Loading