Skip to content

Commit

Permalink
dmx_gsf: add limit test on read length
Browse files Browse the repository at this point in the history
ossfuzz issue 67790
  • Loading branch information
aureliendavid committed Apr 15, 2024
1 parent 7a3eca9 commit c29ffa7
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/filters/dmx_gsf.c
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,9 @@ static GF_Err gsfdmx_parse_pid_info(GF_Filter *filter, GSF_DemuxCtx *ctx, GSF_St
GF_PropertyValue p;

u32 len = gsfdmx_read_vlen(bs);
if (len >= GF_UINT_MAX-1)
return GF_BAD_PARAM;

char *pname = gf_malloc(sizeof(char)*(len+1));
gf_bs_read_data(bs, pname, len);
pname[len]=0;
Expand Down Expand Up @@ -1095,7 +1098,7 @@ static GF_Err gsfdmx_demux(GF_Filter *filter, GSF_DemuxCtx *ctx, char *data, u32
//buffer was not big enough to contain all the vlen fields, we need more data
if (ctx->buffer_too_small)
break;

if (full_pck) {
block_size = pck_len;
block_offset = 0;
Expand Down Expand Up @@ -1376,7 +1379,7 @@ GF_FilterRegister GSFDemuxRegister = {
#endif
,
#endif

.private_size = sizeof(GSF_DemuxCtx),
.args = GSFDemuxArgs,
.flags = GF_FS_REG_DYNAMIC_PIDS,
Expand All @@ -1400,4 +1403,3 @@ const GF_FilterRegister *gsfdmx_register(GF_FilterSession *session)
return NULL;
}
#endif // GPAC_DISABLE_GSFDMX

0 comments on commit c29ffa7

Please sign in to comment.