Accepting request 665644 from home:iznogood:branches:Archiving

- Add brotli_Verbose-CLI+Shared-Brotli.patch: Verbose CLI + start
  pulling "Shared-Brotli".
  * verbose CLI output; fix gh#google/brotlie#666.
  * pull `SHIFT` transforms; currently this is semantically dead
    code; later it will be used by "Shared-Brotli".
- Add brotli_Ensure-decompression-consumes-all-input.patch: Ensure
  decompression consumes all input. If not, it's a corrupt stream.
- Tweak spec slightly.

OBS-URL: https://build.opensuse.org/request/show/665644
OBS-URL: https://build.opensuse.org/package/show/Archiving/brotli?expand=0&rev=17
This commit is contained in:
Jan Engelhardt 2019-01-18 00:56:15 +00:00 committed by Git OBS Bridge
parent f6acf6de25
commit bfaa3a8d77
4 changed files with 1479 additions and 13 deletions

View File

@ -1,3 +1,15 @@
-------------------------------------------------------------------
Sun Jan 13 11:24:26 UTC 2019 - bjorn.lie@gmail.com
- Add brotli_Verbose-CLI+Shared-Brotli.patch: Verbose CLI + start
pulling "Shared-Brotli".
* verbose CLI output; fix gh#google/brotlie#666.
* pull `SHIFT` transforms; currently this is semantically dead
code; later it will be used by "Shared-Brotli".
- Add brotli_Ensure-decompression-consumes-all-input.patch: Ensure
decompression consumes all input. If not, it's a corrupt stream.
- Tweak spec slightly.
-------------------------------------------------------------------
Fri Dec 14 11:01:35 UTC 2018 - Jan Engelhardt <jengelh@inai.de>

View File

@ -1,7 +1,7 @@
#
# spec file for package brotli
#
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2017 Buschmann <buschmann23@opensuse.org>
#
# All modifications and additions to the file contributed by third parties
@ -25,16 +25,18 @@ Summary: Lossless Compression Algorithm
License: MIT
Group: Productivity/Archiving/Compression
URL: https://github.com/google/brotli
Source: https://github.com/google/brotli/archive/v%version.tar.gz#/%name-%version.tar.gz
Source: %url/archive/v%version.tar.gz#/%name-%version.tar.gz
Source99: baselibs.conf
Patch: brotli_Verbose-CLI+Shared-Brotli.patch
Patch1: brotli_Ensure-decompression-consumes-all-input.patch
BuildRequires: cmake >= 2.8.6
BuildRequires: gcc-c++
BuildRequires: gzip
BuildRequires: pkg-config
%description
This package contains the brotli command line utility to compress and
decompress data with the brotli compression algorithm.
This package contains the brotli command line utility to compress
and decompress data with the brotli compression algorithm.
Brotli is a generic-purpose lossless compression algorithm that
compresses data using a combination of a modern variant of the LZ77
@ -43,8 +45,8 @@ compression ratio comparable to the best currently available
general-purpose compression methods. It is similar in speed with
deflate but offers more dense compression.
The specification of the Brotli Compressed Data Format is defined in
RFC 7932.
The specification of the Brotli Compressed Data Format is defined
in RFC 7932.
%package -n libbrotlicommon%sover
Summary: Common Library for Brotli Compression
@ -62,17 +64,19 @@ Group: System/Libraries
Decompression library for the Brotli general purpose lossless data
compression algorithm.
The specification of the Brotli Compressed Data Format is defined in
RFC 7932.
The specification of the Brotli Compressed Data Format is defined
in RFC 7932.
%package -n libbrotlienc%sover
Summary: Library for Brotli Compression
Group: System/Libraries
%description -n libbrotlienc%sover
Compression library for the Brotli general purpose lossless data compression algorithm.
Compression library for the Brotli general purpose lossless data
compression algorithm.
The specification of the Brotli Compressed Data Format is defined in RFC 7932.
The specification of the Brotli Compressed Data Format is defined
in RFC 7932.
%package -n libbrotli-devel
Summary: Development and Header Files for Brotli Compression
@ -88,10 +92,11 @@ Obsoletes: libbrotlidec-devel < %version-%release
Obsoletes: libbrotlienc-devel < %version-%release
%description -n libbrotli-devel
Development and headers files for (de)compressing data using the Brotli general
purpose lossless compression algorithm.
Development and headers files for (de)compressing data using the
Brotli general purpose lossless compression algorithm.
The specification of the Brotli Compressed Data Format is defined in RFC 7932.
The specification of the Brotli Compressed Data Format is defined
in RFC 7932.
%prep
%autosetup -p1

View File

@ -0,0 +1,74 @@
From 5805f99a533a8f8118699c0100d8c102f3605f65 Mon Sep 17 00:00:00 2001
From: Justin Ridgewell <justin@ridgewell.name>
Date: Mon, 12 Nov 2018 04:36:00 -0500
Subject: [PATCH] Ensure decompression consumes all input (#730)
* Ensure decompression consumes all input
If not, it's a corrupt stream.
* Use byte strings
---
python/_brotli.cc | 4 ++--
python/tests/decompress_test.py | 4 ++++
python/tests/decompressor_test.py | 9 +++++++++
3 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/python/_brotli.cc b/python/_brotli.cc
index a6f925ef..5e1828e9 100644
--- a/python/_brotli.cc
+++ b/python/_brotli.cc
@@ -414,7 +414,7 @@ static BROTLI_BOOL decompress_stream(BrotliDecoderState* dec,
(*output).insert((*output).end(), buffer, buffer + buffer_length);
}
}
- ok = result != BROTLI_DECODER_RESULT_ERROR;
+ ok = result != BROTLI_DECODER_RESULT_ERROR && !available_in;
Py_END_ALLOW_THREADS
return ok;
@@ -672,7 +672,7 @@ static PyObject* brotli_decompress(PyObject *self, PyObject *args, PyObject *key
if (available_out != 0)
output.insert(output.end(), next_out, next_out + available_out);
}
- ok = result == BROTLI_DECODER_RESULT_SUCCESS;
+ ok = result == BROTLI_DECODER_RESULT_SUCCESS && !available_in;
BrotliDecoderDestroyInstance(state);
Py_END_ALLOW_THREADS
diff --git a/python/tests/decompress_test.py b/python/tests/decompress_test.py
index 7a9e9e30..814e5633 100644
--- a/python/tests/decompress_test.py
+++ b/python/tests/decompress_test.py
@@ -31,6 +31,10 @@ def _test_decompress(self, test_data):
self._decompress(test_data)
self._check_decompression(test_data)
+ def test_garbage_appended(self):
+ with self.assertRaises(brotli.error):
+ brotli.decompress(brotli.compress(b'a') + b'a')
+
_test_utils.generate_test_methods(TestDecompress, for_decompression=True)
diff --git a/python/tests/decompressor_test.py b/python/tests/decompressor_test.py
index 99667bcd..05918ada 100644
--- a/python/tests/decompressor_test.py
+++ b/python/tests/decompressor_test.py
@@ -43,6 +43,15 @@ def _test_decompress(self, test_data):
self._decompress(test_data)
self._check_decompression(test_data)
+ def test_garbage_appended(self):
+ with self.assertRaises(brotli.error):
+ self.decompressor.process(brotli.compress(b'a') + b'a')
+
+ def test_already_finished(self):
+ self.decompressor.process(brotli.compress(b'a'))
+ with self.assertRaises(brotli.error):
+ self.decompressor.process(b'a')
+
_test_utils.generate_test_methods(TestDecompressor, for_decompression=True)

File diff suppressed because it is too large Load Diff