Skip to content

Commit

Permalink
Merge pull request #2788 from gpac/buildbot-error-handling-fixes
Browse files Browse the repository at this point in the history
Error handling fixes
  • Loading branch information
aureliendavid committed Mar 25, 2024
2 parents 2cc9e18 + a61eb1f commit 78b4628
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/media_tools/route_dmx.c
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,11 @@ static GF_Err gf_route_service_gather_object(GF_ROUTEDmx *routedmx, GF_ROUTEServ
}
}

if(total_len && ((u64)start_offset + size > total_len)) {
if((u64)start_offset + size > GF_UINT_MAX) {
GF_LOG(GF_LOG_ERROR, GF_LOG_ROUTE, ("[ROUTE] Service %d TSI %u TOI %u Not supported: Offset (%u) + Size (%u) exceeds the maximum supported value (%u), skipping\n", s->service_id, tsi, toi, start_offset, size, GF_UINT_MAX));
return GF_NOT_SUPPORTED;
}
if(total_len && (start_offset + size > total_len)) {
GF_LOG(GF_LOG_ERROR, GF_LOG_ROUTE, ("[ROUTE] Service %d TSI %u TOI %u Corrupted data: Offset (%u) + Size (%u) exceeds Total Size of the object (%u), skipping\n", s->service_id, tsi, toi, start_offset, size, total_len));
return GF_NOT_SUPPORTED;
}
Expand Down Expand Up @@ -1040,7 +1044,7 @@ static GF_Err gf_route_service_gather_object(GF_ROUTEDmx *routedmx, GF_ROUTEServ
obj->blob.data = obj->payload;
gf_mx_v(routedmx->blob_mx);
}
gf_assert(obj->alloc_size >= (u64)start_offset + size);
gf_assert(obj->alloc_size >= start_offset + size);

memcpy(obj->payload + start_offset, data, size);
GF_LOG(GF_LOG_DEBUG, GF_LOG_ROUTE, ("[ROUTE] Service %d TSI %u TOI %u append LCT fragment, offset %d total size %d recv bytes %d - offset diff since last %d\n", s->service_id, obj->tsi, obj->toi, start_offset, obj->total_length, obj->nb_bytes, (s32) start_offset - (s32) obj->prev_start_offset));
Expand Down Expand Up @@ -2020,7 +2024,7 @@ static GF_Err gf_route_dmx_keep_or_remove_object_by_name(GF_ROUTEDmx *routedmx,
i=0;
while ((obj = gf_list_enum(s->objects, &i))) {
u32 toi;
if (obj->rlct && (sscanf(fileName, obj->rlct->toi_template, &toi) == 1)) {
if (obj->rlct && obj->rlct->toi_template && (sscanf(fileName, obj->rlct->toi_template, &toi) == 1)) {
u32 tsi;
if (toi == obj->toi) {
GF_ROUTELCTChannel *rlct = obj->rlct;
Expand Down

0 comments on commit 78b4628

Please sign in to comment.