Hi,
Attached to this email is a patch which does just what I suggested...
emitting a log message but proceeding normally and ignoring the entry
when a bad filename is encountered during readdir. This fixes the
problem for me.
Jean-Pierre, please review and decide whether this is a good idea.
Best regards,
- Erik
On 2016-04-06 17:27, Erik Larsson wrote:
Hi,
I looked into this image and noticed that there are 4 filenames in
/WINDOWS/system32 that cannot be decoded.
One example is the MFT entry 30661 with the filename (as UTF-16
units): 0xDE5C 0xDC93 0x002E 0x006C 0x006F 0x0067
The filename ends with '.log' but the first two UTF-16 units is where
Unicode decoding blows up. 0xDE5C is the low value of a surrogate pair
according to Wikipedia (range: 0xDC00-0xDFFF). We are expecting the
high value (0xD800-0xDBFF) to come first.
It is then followed by another low value of a surrogate pair, 0xDC93.
This is clearly a corruption... a surrogate pair should consist of a
high value followed by a low value.
I have no idea how this file was created... if Windows did this, then
we might need to be able to cope with such corruption better (e.g.
ignoring the entry during readdir and just emit a log message).
Best regards,
- Erik
On 2016-04-06 13:06, Richard W.M. Jones wrote:
The reporter kindly gave me permission to distribute the metadata
file. I've put it up here:
http://oirase.annexia.org/tmp/bz1301593/
$ md5sum ntfsclone_sda2.xz
6cadc64de3196311c8159dc12f84484c ntfsclone_sda2.xz
Rich.
>From 32b1be23b6f27850a57f415fc2e286ebada391e3 Mon Sep 17 00:00:00 2001
From: Erik Larsson <mec...@users.sourceforge.net>
Date: Wed, 6 Apr 2016 17:46:45 +0200
Subject: [PATCH] Ignore bad UTF-16 filenames during readdir in ntfs-3g and
lowntfs-3g.
---
src/lowntfs-3g.c | 7 ++++---
src/ntfs-3g.c | 7 ++++---
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/src/lowntfs-3g.c b/src/lowntfs-3g.c
index 80c224f..c6a13b7 100644
--- a/src/lowntfs-3g.c
+++ b/src/lowntfs-3g.c
@@ -1133,9 +1133,10 @@ static int ntfs_fuse_filler(ntfs_fuse_fill_context_t *fill_ctx,
return 0;
if ((filenamelen = ntfs_ucstombs(name, name_len, &filename, 0)) < 0) {
- ntfs_log_perror("Filename decoding failed (inode %llu)",
- (unsigned long long)MREF(mref));
- return -1;
+ ntfs_log_warning("Filename decoding failed (inode %llu): %s",
+ (unsigned long long)MREF(mref),
+ strerror(errno));
+ return 0;
}
/* never return inodes 0 and 1 */
if (MREF(mref) > 1) {
diff --git a/src/ntfs-3g.c b/src/ntfs-3g.c
index 4b4ec36..7a603de 100644
--- a/src/ntfs-3g.c
+++ b/src/ntfs-3g.c
@@ -1158,9 +1158,10 @@ static int ntfs_fuse_filler(ntfs_fuse_fill_context_t *fill_ctx,
return 0;
if ((filenamelen = ntfs_ucstombs(name, name_len, &filename, 0)) < 0) {
- ntfs_log_perror("Filename decoding failed (inode %llu)",
- (unsigned long long)MREF(mref));
- return -1;
+ ntfs_log_warning("Filename decoding failed (inode %llu): %s",
+ (unsigned long long)MREF(mref),
+ strerror(errno));
+ return 0;
}
if (ntfs_fuse_is_named_data_stream(filename)) {
--
2.4.9 (Apple Git-60)
------------------------------------------------------------------------------
_______________________________________________
ntfs-3g-devel mailing list
ntfs-3g-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ntfs-3g-devel