[PATCH] NTFS: Bug reading directory indexes with index block vcn != 0

Project:JNode Core
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:patch (code needs review)
Description

When an IndexAllocationBlock gets a request to read an index block which is at a VCN != 0, the existing code incorrectly assumes that these clusters are the same size as the clusters for the filesystem itself.

In actual fact the cluster size of indexes is stored differently; in the case of my own disk image, the index cluster size is 512 bytes but the disk cluster size is 8kbytes.

As a result of this bug, sufficiently large directories do not read correctly (I estimated the size of directory required to cause this problem to be around 40 entries, but it depends on the length of the filenames and also the size of the directory indexes) but instead, offsets into the middle of nowhere and returns garbage or worse, recurses forever on empty filename entries.

this patch solves the problem although I'm not sure if it's the most elegant way because I'm deriving the cluster size from the index size and the number of clusters per index (I couldn't find anywhere else it was stored.)

AttachmentSize
issues_582.88 KB

Bug state

Did this go into 0.2.5? Can the bug be closed? Same goes for other NTFS bugs, some of the ones which aren't marked as fixed or closed seem to have been committed so it might be worth double checking this.

I've tried to apply the

I've tried to apply the patch (issues_59) but I get an error:
patching file fs/src/fs/org/jnode/fs/ntfs/IndexAllocationAttribute.java
patch: **** unexpected end of file in patch

Could you generate a correct version of it?

#1

Status:active» patch (code needs review)

Whoops... a bogus method I had in for checking something was still in that one. Here's one without it.