You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
During a recent analysis of our project using our internally developed static analysis tool, canalyze, we discovered a potential issue with undefined values in the specpack and simpack functions.
Execution path:
In specpack.c at line 33, the input parameter MM for the specpack function is of type g2int, which is a signed integer type.
In specpack.c at line 57, memory space for the tfld array is dynamically allocated.
In specpack.c within lines 63-84, the tfld array is assigned values at lines 80-81.
If the input parameter MM has a negative value, the for-loop starting in specpack.c at line 63 will not execute, leaving the elements of the tfld array uninitialized.
In specpack.c at line 103, the simpack function is called, passing in the pointer to the uninitialized tfld array.
In simpack.c at lines 56-57 the simpack function directly accesses the first element of the fld array using fld[0], at which point this value is an undefined value.
When the specpack function is called with an inadvertently negative MM value, it may lead to the aforementioned issue with undefined values.
Suggested fix: Change the type of input parameter MM for the specpack function to g2intu, which is an unsigned integer type.
The text was updated successfully, but these errors were encountered:
During a recent analysis of our project using our internally developed static analysis tool, canalyze, we discovered a potential issue with undefined values in the
specpack
andsimpack
functions.Execution path:
specpack.c
at line 33, the input parameterMM
for thespecpack
function is of typeg2int
, which is a signed integer type.specpack.c
at line 57, memory space for thetfld
array is dynamically allocated.specpack.c
within lines 63-84, thetfld
array is assigned values at lines 80-81.MM
has a negative value, the for-loop starting inspecpack.c
at line 63 will not execute, leaving the elements of thetfld
array uninitialized.specpack.c
at line 103, thesimpack
function is called, passing in the pointer to the uninitializedtfld
array.simpack.c
at lines 56-57 thesimpack
function directly accesses the first element of the fld array usingfld[0]
, at which point this value is an undefined value.When the
specpack
function is called with an inadvertently negativeMM
value, it may lead to the aforementioned issue with undefined values.Suggested fix: Change the type of input parameter
MM
for thespecpack
function tog2intu
, which is an unsigned integer type.The text was updated successfully, but these errors were encountered: