From e6e0702821d373acb80adb4ec15a4ba986744e5c Mon Sep 17 00:00:00 2001 From: Sreerenj Balachandran Date: Fri, 17 Apr 2015 15:15:33 +0300 Subject: [PATCH] codecparser: h265: Fix nal unit size checking The EOS and EOB nals have the size 2 which is the size of nal unit header itself. The gst_h265_parser_identify_nalu() is not required to scan start code again in this case. In other cases, for a valid nalunit the minimum required size is 3 bytes (2 byte header and at least 1 byte RBSP payload) --- gst-libs/gst/codecparsers/gsth265parser.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gst-libs/gst/codecparsers/gsth265parser.c b/gst-libs/gst/codecparsers/gsth265parser.c index 6b50b08892..563fedff58 100644 --- a/gst-libs/gst/codecparsers/gsth265parser.c +++ b/gst-libs/gst/codecparsers/gsth265parser.c @@ -1269,7 +1269,7 @@ gst_h265_parser_identify_nalu (GstH265Parser * parser, gst_h265_parser_identify_nalu_unchecked (parser, data, offset, size, nalu); - if (res != GST_H265_PARSER_OK || nalu->size == 0) + if (res != GST_H265_PARSER_OK || nalu->size == 2) goto beach; off2 = scan_for_start_codes (data + nalu->offset, size - nalu->offset); @@ -1286,7 +1286,7 @@ gst_h265_parser_identify_nalu (GstH265Parser * parser, off2--; nalu->size = off2; - if (nalu->size < 2) + if (nalu->size < 3) return GST_H265_PARSER_BROKEN_DATA; GST_DEBUG ("Complete nal found. Off: %d, Size: %d", nalu->offset, nalu->size);