diff mbox series

[FFmpeg-devel,v2,4/4] av1_parse: Don't reject zero-size padding OBUs

Message ID 20230124224623.1374077-4-sw@jkqxz.net
State Accepted
Commit 84505310594e61a9eba3a4abbfc00b882db33a08
Headers show
Series [FFmpeg-devel,v2,1/4] cbs_av1: Add tracing headers for metadata types | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Mark Thompson Jan. 24, 2023, 10:46 p.m. UTC
Padding OBUs are not required to be nonempty.
---
 libavcodec/av1_parse.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/libavcodec/av1_parse.c b/libavcodec/av1_parse.c
index b1620eb043..e2f105a8e2 100644
--- a/libavcodec/av1_parse.c
+++ b/libavcodec/av1_parse.c
@@ -88,7 +88,9 @@  int ff_av1_packet_split(AV1Packet *pkt, const uint8_t *buf, int length, void *lo
 
         obu->size_bits = get_obu_bit_length(obu->data, obu->size, obu->type);
 
-        if (obu->size_bits < 0 || (!obu->size_bits && obu->type != AV1_OBU_TEMPORAL_DELIMITER)) {
+        if (obu->size_bits < 0 ||
+            (obu->size_bits == 0 && (obu->type != AV1_OBU_TEMPORAL_DELIMITER &&
+                                     obu->type != AV1_OBU_PADDING))) {
             av_log(logctx, AV_LOG_ERROR, "Invalid OBU of type %d, skipping.\n", obu->type);
             continue;
         }