Skip to content

Commit

Permalink
Fixes #368.
Browse files Browse the repository at this point in the history
Added a (previously-missing) range check on the intermediate layer rates
in the JPC encoder.
Added another image to the test set.
  • Loading branch information
mdadams committed Jan 11, 2024
1 parent ca05a7f commit 6f47e5a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions data/test/good/368_poc_min.pnm
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
P413 1 30
8 changes: 8 additions & 0 deletions src/libjasper/jpc/jpc_enc.c
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,14 @@ static jpc_enc_cp_t *cp_create(const char *optstr, jas_image_t *image)
jas_logwarnf("warning: invalid intermediate layer rates specifier ignored (%s)\n",
jas_tvparser_getval(tvp));
}
/* Ensure that the intermediate layer rates are nonnegative. */
for (i = 0; i < numilyrrates; ++i) {
if (ilyrrates[i] < 0) {
jas_logerrorf(
"intermediate layer rate must be nonnegative\n");
goto error;
}
}
break;

case OPT_JP2OVERHEAD:
Expand Down

0 comments on commit 6f47e5a

Please sign in to comment.