diff options
author | Oliver Smith-Denny <osde@microsoft.com> | 2025-04-25 14:23:58 -0700 |
---|---|---|
committer | Liming Gao <gaoliming@byosoft.com.cn> | 2025-05-07 11:27:35 +0800 |
commit | 5bc52de6877a1e70adc91e3242394044155518bb (patch) | |
tree | 81ea9a165484afc3b0db3707e00718973d39bb05 /BaseTools/Plugin/WindowsResourceCompiler | |
parent | 867fad874a019b629ee55aff2b0ef9af0fe1358c (diff) | |
download | edk2-master.tar.gz edk2-master.tar.bz2 edk2-master.zip |
The DebugImageInfoTable contains an array of image info
structures. The current implementation removes an entry by
freeing the info structure and putting NULL in that entry of
the array. It then decrements the table size tracked in the table.
However, the array is invalid at this point, it contains a NULL
entry, which the UEFI spec does not envision and it contains a valid
entry past the end of the array as tracked in the spec defined config
table. If the table is consumed at this point it can lead to an
invalid assessment of the image state, which defeats the purpose of
the table.
When a new info structure is added, it then scans for the first NULL
entry adds a pointer to the new info structure there and increments
the table size to cover the entrythat was formerly past the end of
the array.
The current implementation requires that once an unload happens,
more loads happen than unloads and that the last operation is not
an unload (which won't be true in the shell, e.g.). This is
needlessly complex, as the order of the table doesn't matter
(and in fact this implementation doesn't preserve image loading
order either).
This patch updates the removal function to free the desired
info structure, move the last entry of the array to this freed
spot, mark the last entry as NULL, and decrement the table count.
The entry addition function then just always puts a new entry at
the end of the array, expanding it as necessary. This simplifies
the logic and covers the gaps that were present.
Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
Diffstat (limited to 'BaseTools/Plugin/WindowsResourceCompiler')
0 files changed, 0 insertions, 0 deletions