Browse files

Fixed ISO9660 filesystem directory parsing with a lot of entries

According to the ISO9660/Ecma-119 standard, directory entries must not cross
the boundary of a sector. That means that there might be some padding after
the last directory entry that still fitted into a sector. SLOF did not take
this into account yet so it failed to find files in directories which used
more than one sector for its directory entries. Now we are taking the padding
into account so the "file not found" problems should be gone.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
  • Loading branch information...
1 parent 8835553 commit 042cb119ecf3b2284c2c4ee01684862d235b705f @huth huth committed Apr 30, 2012
Showing with 18 additions and 7 deletions.
  1. +18 −7 slof/fs/packages/iso-9660.fs
View
25 slof/fs/packages/iso-9660.fs
@@ -147,7 +147,12 @@ INSTANCE VARIABLE index
: path-table-search ( str len -- TRUE | FALSE )
path-table path-tbl-size + path-table ptable @ + DO ( str len )
2dup I 6 + w@-be index @ = ( str len str len )
- -rot I 8 + I c@ string=ci and IF ( str len )
+ -rot I 8 + I c@
+ iso-debug-flag IF
+ ." ISO: comparing path name '"
+ 4dup type ." ' with '" type ." '" cr
+ THEN
+ string=ci and IF ( str len )
s" Directory Matched!! " iso-debug-print ( str len )
self @ index ! ( str len )
I 2 + l@-be dir-addr ! I dup ( str len rec-addr )
@@ -173,9 +178,13 @@ INSTANCE VARIABLE index
dir-addr @ r@ read-data ( str len )
THEN
r> data-buff @ + data-buff @ DO ( str len )
- I 19 + c@ 2 and 0= IF ( str len )
+ I 19 + c@ 2 and 0= I c@ 0<> and IF ( str len )
2dup ( str len str len )
I 21 + I 20 + c@ ( str len str len str' len' )
+ iso-debug-flag IF
+ ." ISO: comparing file name '"
+ 4dup type ." ' with '" type ." '" cr
+ THEN
file-name string=ci IF ( str len )
s" File found!" iso-debug-print ( str len )
I 6 + l@-be 800 * ( str len file-loc )
@@ -187,12 +196,14 @@ INSTANCE VARIABLE index
EXIT
THEN
THEN
- I c@ dup 0= IF ( str len len )
- s" file not found" iso-debug-print
- drop 2drop FALSE ( FALSE )
- UNLOOP
- EXIT
+ ( str len )
+ I c@ ?dup 0= IF
+ 800 I 7ff AND -
+ iso-debug-flag IF
+ ." skipping " dup . ." bytes at end of sector" cr
+ THEN
THEN
+ ( str len offset )
+LOOP
2drop
FALSE ( FALSE )

0 comments on commit 042cb11

Please sign in to comment.