OSDN Git Service

h265_parse: skip zero sized NAL units
authorHendrik Leppkes <h.leppkes@gmail.com>
Sat, 7 May 2016 14:28:39 +0000 (16:28 +0200)
committerDerek Buitenhuis <derek.buitenhuis@gmail.com>
Sat, 7 May 2016 20:14:23 +0000 (21:14 +0100)
Avoids extra error checks later on and/or invalid reads.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
libavcodec/h2645_parse.c

index aac9f99..62d0447 100644 (file)
@@ -333,7 +333,7 @@ int ff_h2645_packet_split(H2645Packet *pkt, const uint8_t *buf, int length,
             ret = hevc_parse_nal_header(nal, logctx);
         else
             ret = h264_parse_nal_header(nal, logctx);
-        if (ret <= 0) {
+        if (ret <= 0 || nal->size <= 0) {
             if (ret < 0) {
                 av_log(logctx, AV_LOG_ERROR, "Invalid NAL unit %d, skipping.\n",
                        nal->type);