fix: two memcpy calls copy data into destination buf... in window.cpp#2729
fix: two memcpy calls copy data into destination buf... in window.cpp#2729orbisai0security wants to merge 1 commit intoWerWolv:masterfrom
Conversation
Automated security fix generated by Orbis Security AI
|
There is no path where previousVtxDataSize is larger than totalVtxDataSize as the size is always compared and consequently resized before the copy loop. ImHex/main/gui/source/window/window.cpp Lines 846 to 862 in 790c19a looks bug prone but it is not, though more idiomatic would be to use previousVtxData.size() rather than previousVtxDataSize. There is however a possible TOCTOU issue, but since ImHex uses ImGui (an immediate UI layer) it usually is only manipulated from one thread (which I think is also the case here) so this is not really a thing. |
it doesn't need to validate because it is directly resizing the vector... ImHex/plugins/decompress/source/content/pl_functions.cpp Lines 258 to 260 in 790c19a |
|
Thanks for the detailed review. I agree with your analysis. Looking again at the surrounding code, I also agree on the I am withdrawing the security claim if you would still accept a small cleanup that uses If not, I'm okay closing this. |
Summary
Security hardening (defence in depth) in
main/gui/source/window/window.cpp.Vulnerability
V-001main/gui/source/window/window.cpp:866Description: Two memcpy calls copy data into destination buffers without first verifying that the destination is large enough to hold the incoming data. In window.cpp:866, the expression
offset + bufSizeis never validated againstpreviousVtxData.size()before the copy. In pl_functions.cpp:260,sectionSize + dataOut.posis never validated againstsection.size(). Both size values can be directly influenced by content within a binary file opened by the user, making this trivially exploitable through normal tool usage.Changes
main/gui/source/window/window.cppVerification
Automated security fix by OrbisAI Security