]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/UdfDxe: reject reserved values in ICB.Flags[2:0]
authorLaszlo Ersek <lersek@redhat.com>
Tue, 12 Sep 2017 21:39:12 +0000 (23:39 +0200)
committerLaszlo Ersek <lersek@redhat.com>
Wed, 13 Sep 2017 22:05:06 +0000 (00:05 +0200)
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 <ard.biesheuvel@linaro.org>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Paulo Alcantara <pcacjr@zytor.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Reported-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reported-by: Gerd Hoffmann <kraxel@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Paulo Alcantara <pcacjr@zytor.com>
MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c

index 2039f80289c352043c9d4acdf03dd22996218624..199c4ca2db2de903195e84b15edb781a9dfe9ed4 100644 (file)
@@ -1147,6 +1147,14 @@ ReadFile (
     ASSERT (FALSE);\r
     Status = EFI_UNSUPPORTED;\r
     break;\r
     ASSERT (FALSE);\r
     Status = EFI_UNSUPPORTED;\r
     break;\r
+\r
+  default:\r
+    //\r
+    // A flag value reserved by the ECMA-167 standard (3rd Edition - June\r
+    // 1997); 14.6 ICB Tag; 14.6.8 Flags (RBP 18); was found.\r
+    //\r
+    Status = EFI_UNSUPPORTED;\r
+    break;\r
   }\r
 \r
 Done:\r
   }\r
 \r
 Done:\r