diff mbox series

[FFmpeg-devel,v2,10/11] avformat/dvdvideodec: check the length of a NAV packet when reading titles

Message ID 20240923051941.54124-11-marth64@proxyid.net
State New
Headers show
Series avformat/dvdvideodec: bugfixes and menu chapter markers | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Marth64 Sept. 23, 2024, 5:19 a.m. UTC
Some discs present titles with bogus NAV packets. We apply this check
for menus and for title MPEG blocks, but we should also apply it
for NAV packets during title demuxing.

Signed-off-by: Marth64 <marth64@proxyid.net>
---
 libavformat/dvdvideodec.c | 7 +++++++
 1 file changed, 7 insertions(+)
diff mbox series

Patch

diff --git a/libavformat/dvdvideodec.c b/libavformat/dvdvideodec.c
index 6f947c3927..e1c335f270 100644
--- a/libavformat/dvdvideodec.c
+++ b/libavformat/dvdvideodec.c
@@ -740,6 +740,13 @@  static int dvdvideo_play_next_ps_block(AVFormatContext *s, DVDVideoPlaybackState
                     return AVERROR_EOF;
                 }
 
+                if (nav_len != DVDVIDEO_BLOCK_SIZE) {
+                    av_log(s, AV_LOG_ERROR, "Invalid NAV packet size (expected=%d actual=%d)\n",
+                                            DVDVIDEO_BLOCK_SIZE, nav_len);
+
+                    return AVERROR_INVALIDDATA;
+                }
+
                 e_pci = dvdnav_get_current_nav_pci(state->dvdnav);
                 e_dsi = dvdnav_get_current_nav_dsi(state->dvdnav);