Commit e6e07028 authored by Sreerenj Balachandran's avatar Sreerenj Balachandran Committed by Sebastian Dröge

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)
parent af7ff2bd
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment