summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaszlo Ersek <lersek@redhat.com>2017-09-09 23:25:33 +0200
committerLaszlo Ersek <lersek@redhat.com>2017-09-12 12:12:18 +0200
commita3240c63ec33b704865618aa18eebe64a33a2dba (patch)
tree692e763f5d93ca17f38535060dc453e81cd1922d
parentc05cae55ebd800308d04ff8f2eef948aaf567732 (diff)
downloadedk2-a3240c63ec33b704865618aa18eebe64a33a2dba.tar.gz
edk2-a3240c63ec33b704865618aa18eebe64a33a2dba.tar.bz2
edk2-a3240c63ec33b704865618aa18eebe64a33a2dba.zip
MdeModulePkg/UdfDxe: ASSERT() valid ReadFileInfo Flags for INLINE_DATA req
In the ReadFile() function, if "RecordingFlags" is INLINE_DATA, then we cover the following values of "ReadFileInfo->Flags": - READ_FILE_GET_FILESIZE - READ_FILE_ALLOCATE_AND_READ - READ_FILE_SEEK_AND_READ We don't do anything (just proceed to the end of the function) if "ReadFileInfo->Flags" is anything else. In reality the above three values cover the domain of the UDF_READ_FILE_FLAGS enum type fully, and "ReadFileInfo->Flags" is only ever set internally to UdfDxe. Therefore any other flag value would be a bug in UdfDxe. ASSERT() specifically that "ReadFileInfo->Flags" has been set correctly, so that the reader is not left wondering what happens if none of the enum constants match. 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> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Paulo Alcantara <pcacjr@zytor.com> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
-rw-r--r--MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c b/MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c
index 904262a2ba..842c7f8f09 100644
--- a/MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c
+++ b/MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c
@@ -962,6 +962,9 @@ ReadFile (
);
ReadFileInfo->FilePosition += ReadFileInfo->FileDataSize;
+ } else {
+ ASSERT (FALSE);
+ return EFI_INVALID_PARAMETER;
}
break;