-
Notifications
You must be signed in to change notification settings - Fork 5.3k
[mono][aot] Avoid use of local buffer that could overflow #118985
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR eliminates a potential buffer overflow vulnerability in the Mono AOT compiler by removing the use of a local buffer for symbol name handling. The change replaces sprintf operations that could exceed buffer bounds with direct usage of existing symbol strings.
Key Changes:
- Removes local
symbolbuffer that was vulnerable to overflow - Eliminates unnecessary
sprintfcalls for symbol name copying - Uses
acfg->got_symboldirectly instead of copying to local buffer
|
@simonrozsival Looked over other uses of |
vitek-karas
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
I don't understand why the code copied the strings before - makes no sense...
Long time ago AOT code had a pattern of always using |
8432bb3 to
fe12c4f
Compare
|
This has to go to .NET 10 - we should prioritize this. |
1b0e106 to
c528244
Compare
c528244 to
fe12c4f
Compare
|
This seems to consistently fail on windows WasmBuildTests even though it makes zero sense (it seems it only fails on my PR?). The change is trivial and it shouldn't even be hit on wasm, since the aot-compiler should only run in llvmonly mode. I tried reproducing locally both on macos and on windows but I didn't notice anything extraordinary. With or without my change there are failures. Any thoughts about this failure, whether this is safe to go in ? @lewing @pavelsavara For example https://helixr1107v0xdcypoyl9e7f.blob.core.windows.net/dotnet-runtime-refs-pull-118985-merge-18337050e6e64ed191/NoFingerprint-ST-Wasm.Build.Tests/1/console.256ab69f.log?helixlogtype=result , currently there is not even any info https://helix.dot.net/api/2019-06-17/jobs/08f65c11-4d59-420d-b4d9-1294fb2af40b/workitems/NoWebcil-ST-Wasm.Build.NativeRebuild.Tests.OptimizationFlagChangeTests/console |
Yes, timeouts in WasmBasicTest are known. They are not easy to fix, sorry. |
|
/backport to release/10.0 |
|
Started backporting to release/10.0: https://github.com/dotnet/runtime/actions/runs/17322274062 |
Fixes https://devdiv.visualstudio.com/DevDiv/_workitems/edit/2530461