VirtualBox

Ignore:
Timestamp:
Mar 31, 2025 11:31:09 AM (2 weeks ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
168237
Message:

Devices/EFI/FirmwareNew: Merge edk2-stable202502 from the vendor branch and make it build for the important platforms, bugref:4643

Location:
trunk/src/VBox/Devices/EFI/FirmwareNew
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/EFI/FirmwareNew

  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellDebug1CommandsLib/EfiDecompress.c

    r101291 r108794  
    8686    } else {
    8787      TempParam = ShellCommandLineGetRawValue (Package, 1);
    88       ASSERT (TempParam != NULL);
     88      if (TempParam == NULL) {
     89        ASSERT (TempParam != NULL);
     90        ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"efidecompress");
     91        ShellStatus = SHELL_INVALID_PARAMETER;
     92        goto Done;
     93      }
     94
    8995      InFileName  = ShellFindFilePath (TempParam);
    9096      OutFileName = ShellCommandLineGetRawValue (Package, 2);
    91       if (InFileName == NULL) {
     97      if ((InFileName == NULL) || (OutFileName == NULL)) {
    9298        ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_FILE_FIND_FAIL), gShellDebug1HiiHandle, L"efidecompress", TempParam);
    9399        ShellStatus = SHELL_NOT_FOUND;
     
    113119        if (ShellStatus == SHELL_SUCCESS) {
    114120          Status = FileHandleGetSize (InFileHandle, &Temp64Bit);
    115           ASSERT_EFI_ERROR (Status);
    116           if (!EFI_ERROR (Status)) {
    117             ASSERT (Temp64Bit <= (UINT32)(-1));
    118             InSize   = (UINTN)Temp64Bit;
    119             InBuffer = AllocateZeroPool (InSize);
    120           }
    121 
     121          if (EFI_ERROR (Status)) {
     122            ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellDebug1HiiHandle, L"efidecompress", ShellCommandLineGetRawValue (Package, 1));
     123            ShellStatus = SHELL_NOT_FOUND;
     124          }
     125        }
     126
     127        if (ShellStatus == SHELL_SUCCESS) {
     128          //
     129          // Limit the File Size to UINT32, even though calls accept UINTN.
     130          // 32 bits = 4gb.
     131          //
     132          Status = SafeUint64ToUint32 (Temp64Bit, (UINT32 *)&InSize);
     133          if (EFI_ERROR (Status)) {
     134            ASSERT_EFI_ERROR (Status);
     135            ShellStatus = SHELL_BAD_BUFFER_SIZE;
     136            goto Done;
     137          }
     138
     139          InBuffer = AllocateZeroPool (InSize);
    122140          if (InBuffer == NULL) {
    123141            Status = EFI_OUT_OF_RESOURCES;
     
    167185    }
    168186
     187Done:
     188
    169189    ShellCommandLineFreeVarList (Package);
    170190  }
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette