From 998aee899e49b37b217a0c842f6340ca27e6fa73 Mon Sep 17 00:00:00 2001 From: Laszlo Ersek Date: Tue, 12 Sep 2017 23:39:12 +0200 Subject: [PATCH] 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 Cc: Eric Dong Cc: Paulo Alcantara Cc: Ruiyu Ni Cc: Star Zeng Reported-by: Ard Biesheuvel Reported-by: Gerd Hoffmann Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Laszlo Ersek Reviewed-by: Ruiyu Ni Reviewed-by: Star Zeng Reviewed-by: Paulo Alcantara --- 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 2039f80289..199c4ca2db 100644 --- a/MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c +++ b/MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c @@ -1147,6 +1147,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.39.2