From c1ba44d83cc7d9d756cfb063717852eae9d03328 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sat, 27 Mar 2021 22:12:41 -0700
Subject: [PATCH] initialize encoder/decoder state in the constructors

Author: Jakub Wilk <jwilk@debian.org>

Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 include/b64/decode.h | 4 +++-
 include/b64/encode.h | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/include/b64/decode.h b/include/b64/decode.h
index e9019f3..aefb7bc 100644
--- a/include/b64/decode.h
+++ b/include/b64/decode.h
@@ -25,7 +25,9 @@ namespace base64
 
 		decoder(int buffersize_in = BUFSIZ)
 		: _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 e7a7035..33848b3 100644
--- a/include/b64/encode.h
+++ b/include/b64/encode.h
@@ -25,7 +25,9 @@ namespace base64
 
 		encoder(int buffersize_in = BUFSIZ)
 		: _buffersize(buffersize_in)
-		{}
+		{
+			base64_init_encodestate(&_state);
+		}
 
 		int encode(char value_in)
 		{
