Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
sgpd box entry: disallow null grouping_type (#2389)
  • Loading branch information
aureliendavid committed Feb 9, 2023
1 parent 8db20cb commit ea7395f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
7 changes: 5 additions & 2 deletions src/isomedia/box_code_base.c
Expand Up @@ -4429,7 +4429,7 @@ GF_Err video_sample_entry_box_size(GF_Box *s)

/*VVC*/
gf_isom_check_position(s, (GF_Box *)ptr->vvc_config, &pos);

/*AV1*/
gf_isom_check_position(s, (GF_Box *)ptr->av1_config, &pos);

Expand Down Expand Up @@ -8857,7 +8857,7 @@ GF_Err dac3_box_write(GF_Box *s, GF_BitStream *bs)
e = gf_isom_box_write_header(s, bs);
if (ptr->cfg.is_ec3) s->type = GF_ISOM_BOX_TYPE_DAC3;
if (e) return e;

e = gf_odf_ac3_cfg_write_bs(&ptr->cfg, bs);
if (e) return e;

Expand Down Expand Up @@ -9983,6 +9983,9 @@ static void *sgpd_parse_entry(u32 grouping_type, GF_BitStream *bs, s32 bytes_in_
}
return ptr;
}
case 0:
GF_LOG(GF_LOG_WARNING, GF_LOG_CONTAINER, ("[iso file] sgpd entry null grouping_type is invalid\n") );
return NULL;
default:
break;
}
Expand Down
8 changes: 4 additions & 4 deletions src/isomedia/box_funcs.c
Expand Up @@ -104,7 +104,7 @@ GF_Err gf_isom_box_parse_ex(GF_Box **outBox, GF_BitStream *bs, u32 parent_type,
GF_Box *newBox;
Bool skip_logs = (gf_bs_get_cookie(bs) & GF_ISOM_BS_COOKIE_NO_LOGS ) ? GF_TRUE : GF_FALSE;
Bool is_special = GF_TRUE;

if ((bs == NULL) || (outBox == NULL) ) return GF_BAD_PARAM;
*outBox = NULL;
if (gf_bs_available(bs) < 8) {
Expand Down Expand Up @@ -1528,7 +1528,7 @@ static struct box_registry_entry {
BOX_DEFINE_S_CHILD( GF_QT_SUBTYPE_YVYU, video_sample_entry, "stsd", "apple"),
BOX_DEFINE_S_CHILD( GF_QT_SUBTYPE_RGBA, video_sample_entry, "stsd", "apple"),
BOX_DEFINE_S_CHILD( GF_QT_SUBTYPE_ABGR, video_sample_entry, "stsd", "apple"),

FBOX_DEFINE_S(GF_QT_BOX_TYPE_STPS, stss, "stbl", 0, "apple"),

//dolby boxes
Expand Down Expand Up @@ -1918,7 +1918,7 @@ void gf_isom_check_position(GF_Box *s, GF_Box *child, u32 *pos)

s32 cur_pos = gf_list_find(s->child_boxes, child);

//happens when partially cloning boxes
//happens when partially cloning boxes
if (cur_pos < 0) return;

if (cur_pos != (s32) *pos) {
Expand Down Expand Up @@ -1949,7 +1949,7 @@ GF_Err gf_isom_box_write(GF_Box *a, GF_BitStream *bs)
if (!a) return GF_BAD_PARAM;
//box has been disabled, do not write
if (!a->size) return GF_OK;

if (a->registry->disabled) {
GF_LOG(GF_LOG_DEBUG, GF_LOG_CONTAINER, ("[iso file] Box %s disabled registry, skip write\n", gf_4cc_to_str(a->type)));
return GF_OK;
Expand Down
6 changes: 3 additions & 3 deletions src/isomedia/isom_read.c
Expand Up @@ -2304,7 +2304,7 @@ GF_Err gf_isom_get_sample_for_media_time(GF_ISOFile *the_file, u32 trackNumber,
}
if (static_sample && ! (*sample)->alloc_size )
(*sample)->alloc_size = (*sample)->dataLength;

return GF_OK;
}

Expand Down Expand Up @@ -4674,7 +4674,7 @@ const u32 *gf_isom_get_track_switch_parameter(GF_ISOFile *movie, u32 trackNumber
if (!map) return NULL;
tsel = (GF_TrackSelectionBox*)gf_list_get(map->boxes, group_index-1);
if (!tsel) return NULL;

*switchGroupID = tsel->switchGroup;
*criteriaListSize = tsel->attributeListCount;
return (const u32 *) tsel->attributeList;
Expand Down Expand Up @@ -5409,7 +5409,7 @@ GF_Err gf_isom_get_sample_cenc_info_internal(GF_TrackBox *trak, void *traf, GF_S
if (skip_byte_block) *skip_byte_block = 0;
if (key_info) *key_info = NULL;
if (key_info_size) *key_info_size = 0;

if (!trak) return GF_BAD_PARAM;

#ifdef GPAC_DISABLE_ISOM_FRAGMENTS
Expand Down

0 comments on commit ea7395f

Please sign in to comment.