]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/BufferImage.c
pointer verification (not NULL) and buffer overrun fixes.
[mirror_edk2.git] / ShellPkg / Library / UefiShellDebug1CommandsLib / HexEdit / BufferImage.c
index 60e0b75435adad5fa3125074fc9fd64458af5b37..675850cff4661c60f39326993650207e3c6a42aa 100644 (file)
@@ -637,7 +637,7 @@ HBufferImageRestoreMousePosition (
         CurrentLine = HBufferImage.CurrentLine;\r
         Line        = HMoveLine (FRow - HBufferImage.BufferPosition.Row);\r
 \r
-        if (FColumn > Line->Size) {\r
+        if (Line == NULL || FColumn > Line->Size) {\r
           HasCharacter = FALSE;\r
         }\r
 \r
@@ -1620,7 +1620,7 @@ Returns:
       //\r
       HBufferImage.BufferPosition.Row = NewFilePosRow;\r
       if (RowGap <= 0) {\r
-        Abs = -RowGap;\r
+        Abs = (UINTN)ABS(RowGap);\r
         HBufferImage.DisplayPosition.Row -= Abs;\r
       } else {\r
         HBufferImage.DisplayPosition.Row += RowGap;\r
@@ -1931,7 +1931,7 @@ Returns:
   //\r
   // if that line, is not that long, so move to the end of that line\r
   //\r
-  if (FCol > Line->Size) {\r
+  if (Line != NULL && FCol > Line->Size) {\r
     FCol      = Line->Size + 1;\r
     HighBits  = TRUE;\r
   }\r