// Now compute the length representation
long buffer = length & 0x7F;
- while ((length >>= 7) > 0)
+ // Avoid altering length variable; PR42551
+ lengthValue = length;
+ while ((lengthValue >>= 7) > 0)
{
buffer <<= 8;
- buffer |= ((length & 0x7F) | 0x80);
+ buffer |= ((lengthValue & 0x7F) | 0x80);
}
// Now store the variable length length value