summaryrefslogtreecommitdiffstats
path: root/package/libb64/0002-Initialize-C++-objects.patch
diff options
context:
space:
mode:
authorMikael Eliasson <mikael@robomagi.com>2018-08-23 16:04:46 +0200
committerThomas Petazzoni <thomas.petazzoni@bootlin.com>2019-02-06 16:17:54 +0100
commit3d76bde1a9b1e15f435b9070ee338be393f0f893 (patch)
treed3f9c97af79ee4597d9c7d328945ec5d2b0bdaf3 /package/libb64/0002-Initialize-C++-objects.patch
parent2c74d0aabb11a23a0a3e86827795a223b61cf42e (diff)
downloadbuildroot-3d76bde1a9b1e15f435b9070ee338be393f0f893.tar.gz
buildroot-3d76bde1a9b1e15f435b9070ee338be393f0f893.zip
package/libb64: fix integer overflow and uninitialized C++ objects
Fixes a runtime bug on compilers where unsigned char is the default. Fixes a runtime bug where _state variable in the encoder and decoder c++ objects where not initialized by the constructors. Signed-off-by: Mikael Eliasson <mikael@robomagi.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Diffstat (limited to 'package/libb64/0002-Initialize-C++-objects.patch')
-rw-r--r--package/libb64/0002-Initialize-C++-objects.patch38
1 files changed, 38 insertions, 0 deletions
diff --git a/package/libb64/0002-Initialize-C++-objects.patch b/package/libb64/0002-Initialize-C++-objects.patch
new file mode 100644
index 0000000000..1556f889d1
--- /dev/null
+++ b/package/libb64/0002-Initialize-C++-objects.patch
@@ -0,0 +1,38 @@
+Fixes uninitialized C++ encoder and decoder _state variable bug.
+
+Fetched from: https://sources.debian.org/patches/libb64/1.2-5/
+
+initialize-coder-state.diff patch without modifications.
+
+Signed-off-by: Mikael Eliasson <mikael@robomagi.com>
+
+diff --git a/include/b64/decode.h b/include/b64/decode.h
+index 12b16ea..d3f7d60 100644
+--- a/include/b64/decode.h
++++ b/include/b64/decode.h
+@@ -24,7 +24,9 @@ namespace base64
+
+ decoder(int buffersize_in = BUFFERSIZE)
+ : _buffersize(buffersize_in)
+- {}
++ {
++ base64_init_decodestate(&_state);
++ }
+
+ int decode(char value_in)
+ {
+diff --git a/include/b64/encode.h b/include/b64/encode.h
+index 5d807d9..49aafdc 100644
+--- a/include/b64/encode.h
++++ b/include/b64/encode.h
+@@ -24,7 +24,9 @@ namespace base64
+
+ encoder(int buffersize_in = BUFFERSIZE)
+ : _buffersize(buffersize_in)
+- {}
++ {
++ base64_init_encodestate(&_state);
++ }
+
+ int encode(char value_in)
+ {
OpenPOWER on IntegriCloud