Detect a possible overflow directly in the TLV parser.
* src/ber-help.c (_ksba_ber_read_tl): Check for overflow of a commonly used sum.
It is quite common to have checks like
if (ti.nhdr + ti.length >= DIM(tmpbuf)) return gpg_error (GPG_ERR_TOO_LARGE);
This patch detects possible integer overflows immmediately when
creating the TI object.
- Reported-by: ZDI-CAN-18927, ZDI-CAN-18928, ZDI-CAN-18929