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
{{ message }}
Repository navigation
Veracode Flaw (static): Numeric Errors in 5.3.1 #2925
We would like to move to the latest jemalloc 5.3.1 but our code has to pass a Veracode scan and with the latest jemalloc there are a number of issues raised by Veracode - the most serious rated is at line sz.h:323 for Integer Overflow or Wraparound. Having examined the code we think this would only be an issue when allocating exabytes of memory but nonetheless we are requesting that this line of code is fixed - we are not allowed to make local changes to FOSS source code - we have to pull the release version directly from Github in order to use the code. The full Veracode error description is:
This arithmetic operation results in an integer overflow error. Because the result of this calculation is larger than the maximum possible value for this data type, the result may wrap to become a very small, or negative number, therefore providing an unintended value. Integer overflows can often trigger buffer overflows, which can be exploited to execute arbitrary code.
Veracode also identified these issues:
jemalloc.c:1411: This arithmetic operation results in an integer underflow error. Because the result of this calculation is less than the minimum allowable integer value for this data type, the result may wrap to become a very large, positive number, thereby providing an unintended value. Integer underflows do not generally result in arbitrary code execution but can trigger unexpected application behavior.
sz.h:406: This arithmetic operation results in an integer underflow error. Because the result of this calculation is less than the minimum allowable integer value for this data type, the result may wrap to become a very large, positive number, thereby providing an unintended value. Integer underflows do not generally result in arbitrary code execution but can trigger unexpected application behavior.
@spredolac I have updated the PR with the scan results.
Hi @brookheather , I had to finish something else before getting back here. So, I ran CodeQL locally and it did not report the same problem. With the help of AI I changed the CodeQL code to what it believes Veracode is doing (apparently it thinks that Veracode ignores prior check and taints size as argument then continues taint analysis and blames the line). With tweaked CodeQL I got similar report to the one you posted on prior PR. I created a branch in my fork of jemalloc: https://github.com/spredolac/jemalloc/tree/veracode-fix-selfcheck
If you can please check it and if it fixes your issue I will merge it in the jemalloc. I am trying to avoid lot of churn directly in jemalloc repo, and we can churn as much as we want in my fork.
@spredolac sorry for the delay - we have now run your branch with the code fix through Veracode and it passes 100% so looks fine now - please merge it in. Thanks for fixing this issue!
@spredolac I was hoping to use the official 5.4.0 release however it has failed our Veracode scan at jemalloc.c:1137 with an Integer Overflow or Wraparound. Is is possible to fix this and release a patched version?
Activity
spredolac commentedon May 26, 2026
Hi @brookheather , thanks for reporting. I do not have veracode, so I was wondering if you have a way to run it on the PR 2926?
spredolac commentedon May 28, 2026
@brookheather , merged onto dev branch, when you get a chance please test so that we can close. Thanks!
brookheather commentedon May 28, 2026
Thanks - it will take a few days for us to deploy and retest so will get back to you next week hopefully.
brookheather commentedon May 29, 2026
@spredolac I have updated the PR with the scan results.
spredolac commentedon Jun 5, 2026
Hi @brookheather , I had to finish something else before getting back here. So, I ran CodeQL locally and it did not report the same problem. With the help of AI I changed the CodeQL code to what it believes Veracode is doing (apparently it thinks that Veracode ignores prior check and taints size as argument then continues taint analysis and blames the line). With tweaked CodeQL I got similar report to the one you posted on prior PR. I created a branch in my fork of jemalloc: https://github.com/spredolac/jemalloc/tree/veracode-fix-selfcheck
If you can please check it and if it fixes your issue I will merge it in the jemalloc. I am trying to avoid lot of churn directly in jemalloc repo, and we can churn as much as we want in my fork.
brookheather commentedon Jun 16, 2026
@spredolac sorry for the delay - we have now run your branch with the code fix through Veracode and it passes 100% so looks fine now - please merge it in. Thanks for fixing this issue!
spredolac commentedon Jun 18, 2026
Merged
brookheather commentedon Oct 21, 2026
@spredolac I was hoping to use the official 5.4.0 release however it has failed our Veracode scan at jemalloc.c:1137 with an Integer Overflow or Wraparound. Is is possible to fix this and release a patched version?
[-]Veracode Flaw (static): Numeric Errors[/-][+]Veracode Flaw (static): Numeric Errors in 5.3.1[/+]