Howard Chu writes:
This code is wrong: (..) On most 32 bit machines the "if( chop ...)" comparison must always fail, since ber_slen_t is only 32bits. You should do the test before multiplying chop by 3.
No, chop already fits in ber_slen_t, since it is a ber_len_t/7*3. The check is for overflow in the length field in the final value, the algorithm doesn't handle more than 7 (or was it 6?) bytes. Could add code to handle distinguish even bigger integers, but it didn't seem much point. Anyway, I'll add a comment.