Skip to content

Commit 95dda4a

Browse files
committed
PanasonicV8Decompressor: ensure that image and tile size/pos are multiples of 2
1 parent 90b9db6 commit 95dda4a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/librawspeed/decompressors/PanasonicV8Decompressor.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,8 @@ PanasonicV8Decompressor::DecompressorParamsBuilder::getOutRects(
300300
Array1DRef<const uint16_t> stripHeights) {
301301
if (!imgSize.hasPositiveArea())
302302
ThrowRDE("Empty image requested");
303+
if (imgSize.x % 2 != 0 || imgSize.y % 2 != 0)
304+
ThrowRDE("Image size is not multiple of 2");
303305
const int totalStrips = stripLineOffsets.size();
304306
if (stripWidths.size() != totalStrips || stripHeights.size() != totalStrips)
305307
ThrowRDE("Inputs have mismatched length");
@@ -323,6 +325,11 @@ PanasonicV8Decompressor::DecompressorParamsBuilder::getOutRects(
323325
if (!rect.hasPositiveArea())
324326
ThrowRDE("The tile is empty");
325327

328+
if (rect.pos.x % 2 != 0 || rect.pos.y % 2 != 0)
329+
ThrowRDE("Tile position is not multiple of 2");
330+
if (rect.dim.x % 2 != 0 || rect.dim.y % 2 != 0)
331+
ThrowRDE("Tile size is not multiple of 2");
332+
326333
mOutRects.emplace_back(rect);
327334
}
328335

0 commit comments

Comments
 (0)