Skip to content

Commit

Permalink
qtdemux: bail out when encountering an atom with a size of 0
Browse files Browse the repository at this point in the history
A size 0 atom means the atom extends to the end of the file.  No further
valid atoms will ever follow.  Avoids a subsequent scan for an atom from
one byte earlier after encountering a size 0 atom.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/643>
  • Loading branch information
ystreet committed Sep 21, 2020
1 parent 868149c commit 37f0119
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions gst/isomp4/qtdemux.c
Original file line number Diff line number Diff line change
Expand Up @@ -8833,13 +8833,15 @@ qtdemux_find_atom (GstQTDemux * qtdemux, guint64 * offset,
}

if (lfourcc == fourcc) {
GST_DEBUG_OBJECT (qtdemux, "found fourcc at offset %" G_GUINT64_FORMAT,
*offset);
GST_DEBUG_OBJECT (qtdemux, "found '%" GST_FOURCC_FORMAT " at offset %"
G_GUINT64_FORMAT, GST_FOURCC_ARGS (fourcc), *offset);
break;
} else {
GST_LOG_OBJECT (qtdemux,
"skipping atom '%" GST_FOURCC_FORMAT "' at %" G_GUINT64_FORMAT,
GST_FOURCC_ARGS (fourcc), *offset);
GST_FOURCC_ARGS (lfourcc), *offset);
if (*offset == G_MAXUINT64)
goto locate_failed;
*offset += *length;
}
}
Expand Down

0 comments on commit 37f0119

Please sign in to comment.