From 845da730d5ff405e41a120cfd359e813e3b41964 Mon Sep 17 00:00:00 2001 From: Jiri Kucera Date: Tue, 15 Jun 2021 15:35:15 +0200 Subject: [PATCH] Backport wrudf fixes Fix parsing Volume Descriptor Sequence Exit on allocation failure --- udftools-2.3-backported_fixes.patch | 69 +++++++++++++++++++++++++++++ udftools.spec | 6 ++- 2 files changed, 74 insertions(+), 1 deletion(-) diff --git a/udftools-2.3-backported_fixes.patch b/udftools-2.3-backported_fixes.patch index 112fbc0..94be4b3 100644 --- a/udftools-2.3-backported_fixes.patch +++ b/udftools-2.3-backported_fixes.patch @@ -286,3 +286,72 @@ index 58d810a..0b9e4a7 100644 } else { + +From 7a432b0bcd76cbd6a79925cde213f5d9073df137 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Pali=20Roh=C3=A1r?= +Date: Sat, 12 Jun 2021 12:09:05 +0200 +Subject: [PATCH] wrudf: Fix parsing Volume Descriptor Sequence + +Fixes reading Reserve Volume Descriptor Sequence and fixes crashing when +readTaggedBlock() returns NULL. +--- + wrudf/wrudf.c | 9 +++++---- + 1 file changed, 5 insertions(+), 4 deletions(-) + +diff --git a/wrudf/wrudf.c b/wrudf/wrudf.c +index 79ca383..7a500c9 100644 +--- a/wrudf/wrudf.c ++++ b/wrudf/wrudf.c +@@ -93,6 +93,7 @@ void + initialise(char *devicename) + { + uint32_t i, len, blkno, lastblk, size; ++ int inMainSeq; + long_ad *fsdAd; + short_ad *adSpaceMap; + struct sparablePartitionMap *spm; +@@ -158,17 +159,17 @@ initialise(char *devicename) + /* read Volume Descriptor Sequence */ + blkno = extentMainVolDescSeq.extLocation; + len = extentMainVolDescSeq.extLength; ++ inMainSeq = 1; + + for( i = 0; i < len; blkno++, i += 2048 ) { +- int inMainSeq = 1; +- + if( (p = readTaggedBlock(blkno, ABSOLUTE)) == NULL ) { + if( !inMainSeq ) + fail("Volume Descriptor Sequences read failure\n"); +- blkno = extentRsrvVolDescSeq.extLocation; ++ blkno = extentRsrvVolDescSeq.extLocation - 1; + len = extentRsrvVolDescSeq.extLength; + inMainSeq = 0; +- i = 0; ++ i = (uint32_t) -2048; ++ continue; + } + switch( p->descTag.tagIdent ) { + case TAG_IDENT_PVD: + +From b08c75d234d69b2d1cf07dc639d432db767a775f Mon Sep 17 00:00:00 2001 +From: Jiri Kucera +Date: Sun, 13 Jun 2021 19:37:47 +0200 +Subject: [PATCH] wrudf-cdr.c: Exit on allocation failure + +--- + wrudf/wrudf-cdr.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/wrudf/wrudf-cdr.c b/wrudf/wrudf-cdr.c +index 538167a..27883da 100644 +--- a/wrudf/wrudf-cdr.c ++++ b/wrudf/wrudf-cdr.c +@@ -26,7 +26,7 @@ uint32_t newVATentry() { + sizeVAT += 2048; + vat = realloc(vat, sizeVAT); + if( vat == NULL ) +- printf("VAT reallocation failed\n"); ++ fail("VAT reallocation failed\n"); + } + /* could go through VAT and try to find unused 0xFFFFFFFF entry rather than alloc new one at the end */ + vat[newVATindex] = getNWA() - pd->partitionStartingLocation; diff --git a/udftools.spec b/udftools.spec index 3c28250..2ee282c 100644 --- a/udftools.spec +++ b/udftools.spec @@ -1,7 +1,7 @@ Summary: Linux UDF Filesystem userspace utilities Name: udftools Version: 2.3 -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv2+ URL: http://sourceforge.net/projects/linux-udf/ Source: https://github.com/pali/udftools/releases/download/%{version}/udftools-%{version}.tar.gz @@ -43,6 +43,10 @@ rm -rf %{buildroot}%{_bindir}/udffsck %changelog +* Tue Jun 15 2021 Jiri Kucera - 2.3-2 +- wrudf: Fix parsing Volume Descriptor Sequence +- wrudf: Exit on allocation failure + * Wed Jun 09 2021 Jiri Kucera - 2.3-1 - Update to 2.3