summaryrefslogtreecommitdiff
path: root/archivers/pbzip2/files/patch-BZ2StreamScanner.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2025-01-18 21:26:02 +0100
committerDimitry Andric <dim@FreeBSD.org>2025-01-18 21:28:01 +0100
commit974d3ff054965d2bd2ab884a0579ed06c5a08b07 (patch)
treed06f33f369b60d847c8808b642f8f2389023af0c /archivers/pbzip2/files/patch-BZ2StreamScanner.cpp
parentemulators/virtualbox-ose{,-nox11}-legacy: Add SLAVE_PORT definition (diff)
archivers/pbzip2: fix more issues after libc++ 19 patches
* Ensure the _bz2Header and _bz2HeaderZero members of BZ2StreamScanner do not contain an additional NUL byte. * When comparing the magic header, compare from pHdr->begin() + hsp to pHdr->end(), making the code equivalent to what it was doing using std::basic_string::compare(). Submitted by: paparodeo@proton.me PR: 283655 MFH: 2025Q1
Diffstat (limited to 'archivers/pbzip2/files/patch-BZ2StreamScanner.cpp')
-rw-r--r--archivers/pbzip2/files/patch-BZ2StreamScanner.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/archivers/pbzip2/files/patch-BZ2StreamScanner.cpp b/archivers/pbzip2/files/patch-BZ2StreamScanner.cpp
index 070f227c7ec1..19678e0d7d24 100644
--- a/archivers/pbzip2/files/patch-BZ2StreamScanner.cpp
+++ b/archivers/pbzip2/files/patch-BZ2StreamScanner.cpp
@@ -1,6 +1,16 @@
--- BZ2StreamScanner.cpp.orig 2015-12-17 23:32:49 UTC
+++ BZ2StreamScanner.cpp
-@@ -49,8 +49,8 @@ int BZ2StreamScanner::init( int hInFile, size_t inBuff
+@@ -42,15 +42,15 @@ int BZ2StreamScanner::init( int hInFile, size_t inBuff
+ {
+ dispose();
+
+- CharType bz2header[] = "BZh91AY&SY";
+- // zero-terminated string
++ CharType bz2header[] =
++ { 'B', 'Z', 'h', '9', '1', 'A', 'Y', '&', 'S', 'Y' };
+ CharType bz2ZeroHeader[] =
+- { 'B', 'Z', 'h', '9', 0x17, 0x72, 0x45, 0x38, 0x50, 0x90, 0 };
++ { 'B', 'Z', 'h', '9', 0x17, 0x72, 0x45, 0x38, 0x50, 0x90 };
_hInFile = hInFile;
_eof = false;
@@ -35,7 +45,7 @@
// compare the remaining part of magic header
- int cmpres = pHdr->compare( hsp, pHdr->size() - hsp,
- getInBuffSearchPtr() + hsp, pHdr->size() - hsp );
-+ bool cmpres = equal( pHdr->begin() + hsp, pHdr->begin() + pHdr->size() - hsp,
++ bool cmpres = equal( pHdr->begin() + hsp, pHdr->end(),
+ getInBuffSearchPtr() + hsp );
+