The unified diff between revisions [853c4385..] and [b3f30c54..] is displayed below. It can also be downloaded as a raw diff.
This diff has been restricted to the following files: 'src/big_code.cpp'
#
#
# patch "src/big_code.cpp"
# from [915b26c66b35a50ffc838ae5ab688325683c4e43]
# to [dd4d17bf1561349dc289fc05fc32b4522cbf0f3b]
#
============================================================
--- src/big_code.cpp 915b26c66b35a50ffc838ae5ab688325683c4e43
+++ src/big_code.cpp dd4d17bf1561349dc289fc05fc32b4522cbf0f3b
@@ -1,6 +1,6 @@
/*************************************************
* BigInt Encoding/Decoding Source File *
-* (C) 1999-2007 The Botan Project *
+* (C) 1999-2007 Jack Lloyd *
*************************************************/
#include <botan/bigint.h>
@@ -104,7 +104,7 @@ BigInt BigInt::decode(const byte buf[],
SecureVector<byte> hex;
for(u32bit j = 0; j != length; ++j)
if(Hex_Decoder::is_valid(buf[j]))
- hex.push_back(buf[j]);
+ hex.append(buf[j]);
u32bit offset = (hex.size() % 2);
SecureVector<byte> binary(hex.size() / 2 + offset);
@@ -124,6 +124,13 @@ BigInt BigInt::decode(const byte buf[],
const u32bit RADIX = ((base == Decimal) ? 10 : 8);
for(u32bit j = 0; j != length; ++j)
{
+ if(Charset::is_space(buf[j]))
+ continue;
+
+ if(!Charset::is_digit(buf[j]))
+ throw Invalid_Argument("BigInt::decode: "
+ "Invalid character in decimal input");
+
byte x = Charset::char2digit(buf[j]);
if(x >= RADIX)
{