Skip to content
This repository was archived by the owner on Jul 29, 2024. It is now read-only.

Commit 9a2feb2

Browse files
author
lijing0010
authored
Add protection for segments (#355)
Signed-off-by: Jing Li <[email protected]>
1 parent 6322e81 commit 9a2feb2

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Source/Lib/Codec/EbEncDecSegments.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,14 @@ void EncDecSegmentsInit(
5858
{
5959
unsigned x, y, yLast;
6060
unsigned rowIndex, bandIndex, segmentIndex;
61+
EB_U32 max_row_count = segmentsPtr->segmentMaxRowCount;
62+
EB_U32 max_col_count = segmentsPtr->segmentMaxBandCount - segmentsPtr->segmentMaxRowCount;
6163

6264
segColCount = (segColCount <= picWidthLcu) ? segColCount : picWidthLcu;
65+
segColCount = (segColCount <= max_col_count) ? segColCount : max_row_count;
6366
segRowCount = (segRowCount <= picHeightLcu) ? segRowCount : picHeightLcu;
67+
segRowCount = (segRowCount <= max_row_count) ? segRowCount : max_row_count;
68+
6469
segmentsPtr->lcuRowCount = picHeightLcu;
6570
segmentsPtr->lcuBandCount = BAND_TOTAL_COUNT(picHeightLcu, picWidthLcu);
6671
segmentsPtr->segmentRowCount = segRowCount;

0 commit comments

Comments
 (0)