Skip to content

Commit

Permalink
OpenDuet: Fix undefined behavior due to uninited memory (acidanthera#159
Browse files Browse the repository at this point in the history
  • Loading branch information
nms42 authored Nov 28, 2020
1 parent 2bc39a9 commit 21396d0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Legacy/BootPlatform/BiosVideo/LegacyBiosThunk.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ InitializeBiosIntCaller (
);
ASSERT_EFI_ERROR (Status);

ZeroMem ((VOID*)(UINTN) LegacyRegionBase, LegacyRegionSize);

ThunkContext->RealModeBuffer = (VOID*)(UINTN)LegacyRegionBase;
ThunkContext->RealModeBufferSize = LegacyRegionSize;
ThunkContext->ThunkAttributes = THUNK_ATTRIBUTE_BIG_REAL_MODE|THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15;
Expand Down
2 changes: 2 additions & 0 deletions Legacy/BootPlatform/CpuDxe/CpuDxe.c
Original file line number Diff line number Diff line change
Expand Up @@ -1162,6 +1162,8 @@ InitializeBiosIntCaller (
);
ASSERT_EFI_ERROR (Status);

ZeroMem ((VOID*)(UINTN) LegacyRegionBase, LegacyRegionSize);

mThunkContext.RealModeBuffer = (VOID*)(UINTN)LegacyRegionBase;
mThunkContext.RealModeBufferSize = LegacyRegionSize;
mThunkContext.ThunkAttributes = 3;
Expand Down

0 comments on commit 21396d0

Please sign in to comment.