Skip to content

Commit eeecd3e

Browse files
author
Chen, Bohan
committed
Fix coveirty overflowed issues
1 parent 457a59b commit eeecd3e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

encode/av1encode.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ put_ui(bitstream* bs, uint32_t val, int size_in_bits)
7878
{
7979
CHECK_BS_NULL(bs);
8080
CHECK_CONDITION((size_in_bits + bs->bit_offset) <= (8 * bs->max_size_in_byte));
81+
CHECK_CONDITION(size_in_bits > 0 && size_in_bits <= 32);
8182
int remain_bits = 8 - (bs->bit_offset % 8);
8283

8384
// make sure val does not overflow size_in_bits
@@ -2536,6 +2537,7 @@ static int save_codeddata(unsigned long long display_order, unsigned long long e
25362537
if(encode_order == 0)
25372538
{
25382539
//first frame
2540+
CHECK_CONDITION(coded_size >= 44);
25392541
unsigned int ivf_size = coded_size - 32 - 12;
25402542
ret = fseek(coded_fp, frame_start + 32, SEEK_SET);
25412543
CHECK_CONDITION(ret == 0);
@@ -2547,6 +2549,7 @@ static int save_codeddata(unsigned long long display_order, unsigned long long e
25472549
else
25482550
{
25492551
//other frames
2552+
CHECK_CONDITION(coded_size >= 12);
25502553
unsigned int ivf_size = coded_size - 12;
25512554
ret = fseek(coded_fp, frame_start, SEEK_SET);
25522555
CHECK_CONDITION(ret == 0);

0 commit comments

Comments
 (0)