Hi EDK2 Dev,
We met a system hang issue recently and after investigation, it was caused by invalid data returned by “InternalImageHandleToFvHandle” of DxeServicesLib.
We call GetSectionFromAnyFv-> InternalImageHandleToFvHandle to get handle.
But InternalImageHandleToFvHandle cannot locate LoadedImageProtocol (This is expected). The returned status is “Invalid Parameter” and “LoadedImage” pointer is NULL.
The problem is InternalImageHandleToFvHandle does not check returned status or “LoadedImage” pointer, just return “LoadedImage->DeviceHandle”.
Since “LoadedImage” pointer is NULL, “LoadedImage->DeviceHandle” is invalid handle (random data, but not NULL) which cause system hang.
I think InternalImageHandleToFvHandle should check returned status or “LoadedImage” pointer. If it is failed, just return NULL, not any random data.
Best Regards
Rick Cai