[PATCH] ntdll: Print errors when encountering file entries with zero length filenames.
Lei Zhang
thestig at google.com
Wed Dec 3 17:36:22 CST 2008
Hi,
I still see Picasa crashing occasionally due to FindNextFileW()
returning an entry with an empty filename. it might be good to have a
patch like this to help figure out where the bad entries are coming
from.
-------------- next part --------------
From f2ef6d5e411194e51701d1534d37a7514b6d4030 Mon Sep 17 00:00:00 2001
From: Lei Zhang <thestig at google.com>
Date: Wed, 3 Dec 2008 15:31:38 -0800
Subject: [PATCH] ntdll: Print errors when encountering file entries with zero length filenames.
---
dlls/ntdll/directory.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/dlls/ntdll/directory.c b/dlls/ntdll/directory.c
index 8a29098..3ce3926 100644
--- a/dlls/ntdll/directory.c
+++ b/dlls/ntdll/directory.c
@@ -1096,6 +1096,7 @@ static int read_directory_vfat( int fd, IO_STATUS_BLOCK *io, void *buffer, ULONG
de[0].d_name, NULL, mask );
if (info)
{
+ if (info->FileNameLength == 0) ERR("got filename with length 0\n");
last_info = info;
if ((char *)info->FileName + info->FileNameLength > (char *)buffer + length)
{
@@ -1128,6 +1129,7 @@ static int read_directory_vfat( int fd, IO_STATUS_BLOCK *io, void *buffer, ULONG
de[0].d_name, NULL, mask );
if (info)
{
+ if (info->FileNameLength == 0) ERR("got filename with length 0\n");
last_info = info;
if (single_entry) break;
/* check if we still have enough space for the largest possible entry */
@@ -1240,6 +1242,7 @@ static int read_directory_getdents( int fd, IO_STATUS_BLOCK *io, void *buffer, U
!(fake_dot_dot && (!strcmp( de->d_name, "." ) || !strcmp( de->d_name, ".." ))) &&
(info = append_entry( buffer, &io->Information, length, de->d_name, NULL, mask )))
{
+ if (info->FileNameLength == 0) ERR("got filename with length 0\n");
last_info = info;
if ((char *)info->FileName + info->FileNameLength > (char *)buffer + length)
{
@@ -1383,6 +1386,7 @@ static int read_directory_getdirentries( int fd, IO_STATUS_BLOCK *io, void *buff
!(fake_dot_dot && (!strcmp( de->d_name, "." ) || !strcmp( de->d_name, ".." ))) &&
((info = append_entry( buffer, &io->Information, length, de->d_name, NULL, mask ))))
{
+ if (info->FileNameLength == 0) ERR("got filename with length 0\n");
last_info = info;
if ((char *)info->FileName + info->FileNameLength > (char *)buffer + length)
{
@@ -1495,6 +1499,7 @@ static void read_directory_readdir( int fd, IO_STATUS_BLOCK *io, void *buffer, U
old_pos++;
if (info)
{
+ if (info->FileNameLength == 0) ERR("got filename with length 0\n");
last_info = info;
if ((char *)info->FileName + info->FileNameLength > (char *)buffer + length)
{
@@ -1559,6 +1564,7 @@ static int read_directory_stat( int fd, IO_STATUS_BLOCK *io, void *buffer, ULONG
FILE_BOTH_DIR_INFORMATION *info = append_entry( buffer, &io->Information, length, unix_name, NULL, NULL );
if (info)
{
+ if (info->FileNameLength == 0) ERR("got filename with length 0\n");
info->NextEntryOffset = 0;
if ((char *)info->FileName + info->FileNameLength > (char *)buffer + length)
io->u.Status = STATUS_BUFFER_OVERFLOW;
--
1.5.4.5
More information about the wine-patches
mailing list