changeset 48:d71db8e4e1c7 src

add bounds checking in UDFFileEntry Some badly mastered DVDs can have set bogus lengths of the Allocation Descriptors, causing a segfault. This check ensures that the total entry length does not exceed DVD logical block size before processing the entry.
author henry
date Thu, 04 Mar 2010 19:14:17 +0000
parents 9db0de5db7c8
children 1acf15da93ba
files dvd_udf.c
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/dvd_udf.c	Sat Jan 30 15:15:23 2010 +0000
+++ b/dvd_udf.c	Thu Mar 04 19:14:17 2010 +0000
@@ -443,6 +443,10 @@
 
   L_EA = GETN4( 168 );
   L_AD = GETN4( 172 );
+
+  if (176 + L_EA + L_AD > DVD_VIDEO_LB_LEN)
+    return 0;
+
   p = 176 + L_EA;
   while( p < 176 + L_EA + L_AD ) {
     switch( flags & 0x0007 ) {