mirror of
https://github.com/lcn2/calc.git
synced 2025-08-16 01:03:29 +03:00
Fixed internal code bugs
Fixed a really obscure bug in the internal initconstants() function of const.c that has been sitting for over 31 years! We are amazed that nobody has encountered this bug before now. Nevertheless, our very extensive regression and multi-architecture testing found the bug. Now, after all those years, it is fixed. Fixed issues identied by the default CodeUL GitHub security code scan: Wrong type of arguments to printf in have_fpos_pos.c Multiplication result converted to larger type in zfunc.c
This commit is contained in:
5
const.c
5
const.c
@@ -49,7 +49,7 @@ initconstants(void)
|
||||
math_error("Unable to allocate constant table");
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
for (i = 0; consttable[i] != NULL; i++) {
|
||||
for (i = 0; initnumbs[i] != NULL; i++) {
|
||||
consttable[i] = initnumbs[i];
|
||||
}
|
||||
constcount = i-1;
|
||||
@@ -123,6 +123,9 @@ addqconstant(NUMBER *q)
|
||||
tp = consttable;
|
||||
for (index = 0; index < constcount; index++, tp++) {
|
||||
t = *tp;
|
||||
if (t == NULL) { /* paranoia */
|
||||
break;
|
||||
}
|
||||
if (t->links == 0) {
|
||||
if (!havefirst) {
|
||||
havefirst = TRUE;
|
||||
|
Reference in New Issue
Block a user