diff mbox series

[FFmpeg-devel,19/36] avcodec/hevc_mp4toannexb_bsf: Use unchecked bytestream2 API

Message ID 20200530160541.29517-19-andreas.rheinhardt@gmail.com
State New
Headers show
Series [FFmpeg-devel,01/36] avcodec/vp9_superframe_bsf: Check for existence of data before reading it
Related show

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Andreas Rheinhardt May 30, 2020, 4:05 p.m. UTC
We already check manually and error out on invalid data, so we don't
have to rely on the implicit checks provided by the safe version of the
bytestream2 API.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavcodec/hevc_mp4toannexb_bsf.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/hevc_mp4toannexb_bsf.c b/libavcodec/hevc_mp4toannexb_bsf.c
index ba1deb2848..634bfe9c46 100644
--- a/libavcodec/hevc_mp4toannexb_bsf.c
+++ b/libavcodec/hevc_mp4toannexb_bsf.c
@@ -147,14 +147,14 @@  static int hevc_mp4toannexb_filter(AVBSFContext *ctx, AVPacket *out)
             goto fail;
         }
         for (i = 0; i < s->length_size; i++)
-            nalu_size = (nalu_size << 8) | bytestream2_get_byte(&gb);
+            nalu_size = (nalu_size << 8) | bytestream2_get_byteu(&gb);
 
         if (nalu_size < 2 || nalu_size > bytestream2_get_bytes_left(&gb)) {
             ret = AVERROR_INVALIDDATA;
             goto fail;
         }
 
-        nalu_type = (bytestream2_peek_byte(&gb) >> 1) & 0x3f;
+        nalu_type = (bytestream2_peek_byteu(&gb) >> 1) & 0x3f;
 
         /* prepend extradata to IRAP frames */
         is_irap       = nalu_type >= 16 && nalu_type <= 23;
@@ -176,7 +176,7 @@  static int hevc_mp4toannexb_filter(AVBSFContext *ctx, AVPacket *out)
         if (extra_size)
             memcpy(out->data + prev_size, ctx->par_out->extradata, extra_size);
         AV_WB32(out->data + prev_size + extra_size, 1);
-        bytestream2_get_buffer(&gb, out->data + prev_size + 4 + extra_size, nalu_size);
+        bytestream2_get_bufferu(&gb, out->data + prev_size + 4 + extra_size, nalu_size);
     }
 
     ret = av_packet_copy_props(out, in);