impossible conditions in mpi.c
Categories
(NSS :: Libraries, defect)
Tracking
(Not tracked)
People
(Reporter: jp, Unassigned)
Details
Steps to reproduce:
In the latest version 3.104 (as of now), there are two conditions in mpi.c that may never happen.
(1) 'c' may never be null after the check on line 1474 so line 1487 may be safely removed:
1469 mp_mod_d(const mp_int *a, mp_digit d, mp_digit *c)
1470 {
1471 mp_err res;
1472 mp_digit rem;
1473
1474 ARGCHK(a != NULL && c != NULL, MP_BADARG);
...
1487 if (c)
1488 *c = rem;
(2) In mp_to_signed_octets(), we have:
5129 ARGCHK(bytes + 1 <= maxlen, MP_BADARG);
5130 if (bytes + 1 > maxlen)
5131 return MP_BADARG;
Given we verified the value of 'bytes' on 5129, lines 5130-1 may be safely removed.
Actual results:
N/A
Expected results:
The suggested fix is included in the "What did you do?" section.
Reporter | ||
Comment 1•9 months ago
|
||
Oh, I can see now that MP_ARGCHK may be undefined in which case the code is still relevant.
I apologise for the noise, it was reported by parfait with a defined MP_ARGCHK macro.
Description
•