Skip to content

Commit 5aa201c

Browse files
author
Grok Compression
committed
tile cache: handle null processor due to out of bounds
1 parent 63c562b commit 5aa201c

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

src/lib/core/codestream/decompress/CodeStreamDecompress.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1592,7 +1592,8 @@ ITileProcessor* CodeStreamDecompress::getTileProcessor(uint16_t tileIndex)
15921592

15931593
tileProcessor =
15941594
new TileProcessor(tileIndex, tcp, this, stream_, false, tileCache_->getStrategy());
1595-
tileCache_->put(tileIndex, tileProcessor);
1595+
if(!tileCache_->put(tileIndex, tileProcessor))
1596+
return nullptr;
15961597
}
15971598
return tileProcessor;
15981599
}

src/lib/core/codestream/decompress/CodeStreamDecompress_ReadMarkers.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -379,15 +379,17 @@ bool CodeStreamDecompress::readSOT(uint8_t* headerData, uint16_t headerSize)
379379
// Record SOT info for non-slated tiles so tilePartSeq_ is populated
380380
// for potential future decode via decompressFromCachedTileParts()
381381
auto processor = getTileProcessor(tileIndex);
382-
if(!processor->readSOT(this->stream_, headerData, headerSize, currTilePartInfo_, false))
382+
if(!processor ||
383+
!processor->readSOT(this->stream_, headerData, headerSize, currTilePartInfo_, false))
383384
return false;
384385
return currTilePartInfo_.tilePartLength_
385386
? stream_->skip((int64_t)(currTilePartInfo_.tilePartLength_ - sotMarkerSegmentLen))
386387
: true;
387388
}
388389

389390
auto processor = getTileProcessor(tileIndex);
390-
if(!processor->readSOT(this->stream_, headerData, headerSize, currTilePartInfo_, false))
391+
if(!processor ||
392+
!processor->readSOT(this->stream_, headerData, headerSize, currTilePartInfo_, false))
391393
return false;
392394
currTileProcessor_ = processor;
393395
return true;

0 commit comments

Comments
 (0)