Skip to content
Permalink
Browse files Browse the repository at this point in the history
The code now checks for consistency of the MCU sizes across
hierarchical levels, and fails in case they are different.
  • Loading branch information
Thomas Richter committed May 24, 2022
1 parent ef4a29a commit 187035b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README
Expand Up @@ -460,6 +460,8 @@ out-of-bounds symbol triggered and out-of-bounds array access and could
have crashed the decoder. The code is now more carefully changing the
validity of the symbols and aborts with an error if it finds illegal
codes.
The code now also checks the consistency of the MCU sizes in the
hierarchical process and fails if they differ across levels.

--------------------------------------------------------------------------

Expand Down
2 changes: 2 additions & 0 deletions README.history
Expand Up @@ -564,5 +564,7 @@ out-of-bounds symbol triggered and out-of-bounds array access and could
have crashed the decoder. The code is now more carefully changing the
validity of the symbols and aborts with an error if it finds illegal
codes.
The code now also checks the consistency of the MCU sizes in the
hierarchical process and fails if they differ across levels.

--------------------------------------------------------------------------
12 changes: 11 additions & 1 deletion control/hierarchicalbitmaprequester.cpp
Expand Up @@ -45,7 +45,7 @@
** decoding. It also keeps the top-level color transformer and the
** toplevel subsampling expander.
**
** $Id: hierarchicalbitmaprequester.cpp,v 1.42 2020/04/08 10:05:41 thor Exp $
** $Id: hierarchicalbitmaprequester.cpp,v 1.43 2022/05/24 05:42:35 thor Exp $
**
*/

Expand Down Expand Up @@ -245,6 +245,16 @@ void HierarchicalBitmapRequester::PrepareForDecoding(void)
UBYTE sx = comp->SubXOf();
UBYTE sy = comp->SubYOf();

if (m_pLargestScale) {
class Frame *frame = m_pLargestScale->FrameOf();
while(frame) {
if (frame->ComponentOf(i)->SubXOf() != sx || frame->ComponentOf(i)->SubYOf() != sy)
JPG_THROW(MALFORMED_STREAM,"HierarchicalBitmapRequester::PrepareForDecoding",
"component subsampling is inconsistent across hierarchical levels");
frame = frame->NextOf();
}
}

if (sx > 1 || sy > 1) {
m_ppUpsampler[i] = UpsamplerBase::CreateUpsampler(m_pEnviron,sx,sy,
m_ulPixelWidth,m_ulPixelHeight,
Expand Down

0 comments on commit 187035b

Please sign in to comment.