summaryrefslogtreecommitdiff
path: root/asn.cpp
diff options
context:
space:
mode:
authorweidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0>2010-06-18 00:57:26 +0000
committerweidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0>2010-06-18 00:57:26 +0000
commit5f56484a3d47bb203d82bb1bd54136fef1a07056 (patch)
treecfcc298b5b875f50a3fc15f712f0c806906b1474 /asn.cpp
parent5ed048bd178f6a9789c90e65f406e308b3bb35cc (diff)
downloadcryptopp-5f56484a3d47bb203d82bb1bd54136fef1a07056.tar.gz
check for integer overflow in OID::DecodeValue()
git-svn-id: svn://svn.code.sf.net/p/cryptopp/code/trunk/c5@483 57ff6487-cd31-0410-9ec3-f628ee90f5f0
Diffstat (limited to 'asn.cpp')
-rw-r--r--asn.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/asn.cpp b/asn.cpp
index 3ebbaf7..8ae1ad6 100644
--- a/asn.cpp
+++ b/asn.cpp
@@ -232,6 +232,8 @@ size_t OID::DecodeValue(BufferedTransformation &bt, word32 &v)
if (!bt.Get(b))
BERDecodeError();
i++;
+ if (v >> (8*sizeof(v)-7)) // v about to overflow
+ BERDecodeError();
v <<= 7;
v += b & 0x7f;
if (!(b & 0x80))