Reviewed-by: Star Zeng <[email protected]>

-----Original Message-----
From: Laszlo Ersek [mailto:[email protected]] 
Sent: Wednesday, September 13, 2017 6:26 AM
To: edk2-devel-01 <[email protected]>
Cc: Ard Biesheuvel <[email protected]>; Dong, Eric 
<[email protected]>; Paulo Alcantara <[email protected]>; Ni, Ruiyu 
<[email protected]>; Zeng, Star <[email protected]>
Subject: [PATCH 1/2] MdeModulePkg/UdfDxe: reject reserved values in 
ICB.Flags[2:0]

The ECMA-167 standard (3rd Edition, June 1997) reserves values 4 through 7
in the ICB.Flags[2:0] bit-field for future standardization; see "14.6 ICB
Tag" / "14.6.8 Flags (RBP 18)".

https://www.ecma-international.org/publications/standards/Ecma-167.htm

The

  switch (RecordingFlags)

statement in the ReadFile() function handles all the standard values,
using the constants of the UDF_FE_RECORDING_FLAGS enum type. However, the
reserved values are not caught with a "default" case label, which both
breaks the edk2 Coding Style Spec, and leaves the Status variable
un-initialized, before we return Status under the Done label.

Set Status to EFI_UNSUPPORTED if we encounter a reserved value.

This issue was reported by Ard's and Gerd's CI systems independently
(through build failures with GCC48/GCC49, DEBUG/RELEASE targets).

Cc: Ard Biesheuvel <[email protected]>
Cc: Eric Dong <[email protected]>
Cc: Paulo Alcantara <[email protected]>
Cc: Ruiyu Ni <[email protected]>
Cc: Star Zeng <[email protected]>
Reported-by: Ard Biesheuvel <[email protected]>
Reported-by: Gerd Hoffmann <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <[email protected]>
---
 MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c 
b/MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c
index 72862653738e..096fbb4452cb 100644
--- a/MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c
+++ b/MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c
@@ -1150,6 +1150,14 @@ ReadFile (
     ASSERT (FALSE);
     Status = EFI_UNSUPPORTED;
     break;
+
+  default:
+    //
+    // A flag value reserved by the ECMA-167 standard (3rd Edition - June
+    // 1997); 14.6 ICB Tag; 14.6.8 Flags (RBP 18); was found.
+    //
+    Status = EFI_UNSUPPORTED;
+    break;
   }
 
 Done:
-- 
2.14.1.3.gb7cf6e02401b


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

Reply via email to