On 9/12/2017 8:27 AM, Laszlo Ersek wrote:
On 09/12/17 03:30, Paulo Alcantara wrote:
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=704

For root directory, the FID (File Identifier Descriptor) pointer is
accessible through PRIVATE_UDF_FILE_DATA.Root, whereas non-root
directory and regular files, their FIDs are accessible through
PRIVATE_UDF_FILE_DATA.File.

In UdfSetPosition(), the FID was retrieved through
PRIVATE_UDF_FILE_DATA.File, hence when calling it with a root directory,
PRIVATE_UDF_FILE_DATA.File.FileIdentifierDescriptor would be NULL and
then dereferenced.

This patch fixes the NULL pointer dereference by calling _FILE() to
transparently return the correct UDF_FILE_INFO * which points to a valid
FID descriptor of a specific file.

Cc: Star Zeng <[email protected]>
Cc: Eric Dong <[email protected]>
Cc: Ruiyu Ni <[email protected]>
Cc: Laszlo Ersek <[email protected]>
Cc: Steven Shi <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.1
Reported-by: Steven Shi <[email protected]>
Signed-off-by: Paulo Alcantara <[email protected]>
---
  MdeModulePkg/Universal/Disk/UdfDxe/File.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Universal/Disk/UdfDxe/File.c 
b/MdeModulePkg/Universal/Disk/UdfDxe/File.c
index 8b9339567f..a1eb2196df 100644
--- a/MdeModulePkg/Universal/Disk/UdfDxe/File.c
+++ b/MdeModulePkg/Universal/Disk/UdfDxe/File.c
@@ -690,7 +690,8 @@ UdfSetPosition (
PrivFileData = PRIVATE_UDF_FILE_DATA_FROM_THIS (This); - FileIdentifierDesc = PrivFileData->File.FileIdentifierDesc;
+  FileIdentifierDesc = _FILE (PrivFileData)->FileIdentifierDesc;
+  ASSERT (FileIdentifierDesc != NULL);
    if (IS_FID_DIRECTORY_FILE (FileIdentifierDesc)) {
      //
      // If the file handle is a directory, the _only_ position that may be set 
is


Reviewed-by: Laszlo Ersek <[email protected]>

Ping? :-)

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

Reply via email to