Skip to content

Commit

Permalink
A small fix for the limits on U_q. It cannot be larger than missing_m…
Browse files Browse the repository at this point in the history
…sbs + 2, instead of missing_msbs + 1.
  • Loading branch information
aous72 committed Feb 17, 2022
1 parent 06d2ac0 commit 88bb1c6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/core/coding/ojph_block_decoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1258,10 +1258,10 @@ namespace ojph {
}
//decode uvlc_mode to get u for both quads
ui32 consumed_bits = decode_init_uvlc(vlc_val, uvlc_mode, U_q);
if (U_q[0] > missing_msbs + 1 || U_q[1] > missing_msbs + 1)
if (U_q[0] > missing_msbs + 2 || U_q[1] > missing_msbs + 2)
{
OJPH_WARN(0x00010007, "Malformed codeblock bitstream. Uq is larger "
"than missing_msbs + 1.\n");
"than missing_msbs + 2.\n");
return false;
}

Expand Down Expand Up @@ -1537,10 +1537,10 @@ namespace ojph {
U_q[1] += E > 2 ? E - 2 : 0;
}

if (U_q[0] > missing_msbs + 1 || U_q[1] > missing_msbs + 1)
if (U_q[0] > missing_msbs + 2 || U_q[1] > missing_msbs + 2)
{
OJPH_WARN(0x00010007, "Malformed codeblock bitstream. Uq is "
"larger than missing_msbs + 1\n");
"larger than missing_msbs + 2\n");
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion src/core/common/ojph_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@

#define OPENJPH_VERSION_MAJOR 0
#define OPENJPH_VERSION_MINOR 8
#define OPENJPH_VERSION_PATCH 1
#define OPENJPH_VERSION_PATCH 2

0 comments on commit 88bb1c6

Please sign in to comment.