[vlc-commits] contrib: matroska: fix writing on NULL memory
Steve Lhomme
git at videolan.org
Thu May 23 17:40:16 CEST 2019
vlc/vlc-3.0 | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Mon Feb 11 09:58:41 2019 +0100| [30367a475241b6d8e65b016b0c87e37fcdb7deda] | committer: Hugo Beauzée-Luyssen
contrib: matroska: fix writing on NULL memory
https://hackerone.com/reports/493336
Signed-off-by: Hugo Beauzée-Luyssen <hugo at beauzee.fr>
(cherry picked from commit c850ad31fd888bfaf2e63845b78c219e8de70791)
Signed-off-by: Hugo Beauzée-Luyssen <hugo at beauzee.fr>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=30367a475241b6d8e65b016b0c87e37fcdb7deda
---
...on-t-reset-potentially-unallocated-memory.patch | 29 ++++++++++++++++++++++
contrib/src/matroska/rules.mak | 1 +
2 files changed, 30 insertions(+)
diff --git a/contrib/src/matroska/0001-KaxBlock-don-t-reset-potentially-unallocated-memory.patch b/contrib/src/matroska/0001-KaxBlock-don-t-reset-potentially-unallocated-memory.patch
new file mode 100644
index 0000000000..caaf040ffc
--- /dev/null
+++ b/contrib/src/matroska/0001-KaxBlock-don-t-reset-potentially-unallocated-memory.patch
@@ -0,0 +1,29 @@
+From 3fa2eeae1d9148b00ff7cebda7304de90ece575b Mon Sep 17 00:00:00 2001
+From: Steve Lhomme <robux4 at ycbcr.xyz>
+Date: Mon, 11 Feb 2019 09:51:30 +0100
+Subject: [PATCH] KaxBlock: don't reset potentially unallocated memory
+
+When using SCOPE_PARTIAL_DATA the GetBuffer()/Data pointer is never allocated.
+If this exception occurs we must not write on NULL pointed data.
+
+When the memory is allocated it doesn't have any use to reset the memory to 0
+since SetValueIsSet(false) is called right before, invalidating the buffer.
+---
+ src/KaxBlock.cpp | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/src/KaxBlock.cpp b/src/KaxBlock.cpp
+index 3fa18e5..878d9a2 100644
+--- a/src/KaxBlock.cpp
++++ b/src/KaxBlock.cpp
+@@ -703,7 +703,6 @@ filepos_t KaxInternalBlock::ReadData(IOCallback & input, ScopeMode ReadFully)
+ } catch (SafeReadIOCallback::EndOfStreamX &) {
+ SetValueIsSet(false);
+
+- std::memset(EbmlBinary::GetBuffer(), 0, GetSize());
+ myBuffers.clear();
+ SizeList.clear();
+ Timecode = 0;
+--
+2.19.1.windows.1
+
diff --git a/contrib/src/matroska/rules.mak b/contrib/src/matroska/rules.mak
index c2650dd9ce..5ed287e465 100644
--- a/contrib/src/matroska/rules.mak
+++ b/contrib/src/matroska/rules.mak
@@ -18,6 +18,7 @@ $(TARBALLS)/libmatroska-$(MATROSKA_VERSION).tar.xz:
libmatroska: libmatroska-$(MATROSKA_VERSION).tar.xz .sum-matroska
$(UNPACK)
+ $(APPLY) $(SRC)/matroska/0001-KaxBlock-don-t-reset-potentially-unallocated-memory.patch
$(call pkg_static,"libmatroska.pc.in")
$(MOVE)
More information about the vlc-commits
mailing list