The bug can be reproduced by the BltLibSample application
TestMove1() test case. The old code cannot handle the case
when the source and destination video is overlapped.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <[email protected]>
Cc: Laszlo Ersek <[email protected]>
Cc: Jordan Justen <[email protected]>
---
 OptionRomPkg/Library/FrameBufferBltLib/FrameBufferBltLib.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/OptionRomPkg/Library/FrameBufferBltLib/FrameBufferBltLib.c 
b/OptionRomPkg/Library/FrameBufferBltLib/FrameBufferBltLib.c
index 7fd8196..49ef568 100644
--- a/OptionRomPkg/Library/FrameBufferBltLib/FrameBufferBltLib.c
+++ b/OptionRomPkg/Library/FrameBufferBltLib/FrameBufferBltLib.c
@@ -694,6 +694,11 @@ BltLibVideoToVideo (
 
   LineStride = mBltLibWidthInBytes;
   if (Destination > Source) {
+    //
+    // Copy from last line to avoid source is corrupted by copying
+    //
+    Source += Height * LineStride;
+    Destination += Height * LineStride;
     LineStride = -LineStride;
   }
 
-- 
2.8.3.windows.1

_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to