check for integer overflow in OID::DecodeValue()

import/raw
weidai 2010-06-18 00:57:26 +00:00
parent 9ad3f4530d
commit 9c8f570cae
1 changed files with 2 additions and 0 deletions

View File

@ -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))