Potential for infinite recursion in Fat.getChain

Project:JNode FS
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

There appears to be some infinite recursion going on here:

at org.jnode.fs.fat.Fat.getChain(Fat.java:201)
- locked org.jnode.fs.fat.Fat@a62aab
at org.jnode.fs.fat.FatFile.read(FatFile.java:64)
- locked org.jnode.fs.fat.FatFile@1c23da1

Culprit is this loop:

  while (!isEofCluster(entries[(int) cluster])) {
    count++;
    cluster = entries[(int) cluster];
  }

I guess conceptually, if the entries have a cluster which points to itself, or points to somewhere further back in the chain, this can cause an issue.

I know this is the older FAT driver and that jfat is recommended, but AFAIK (correct me if I'm wrong) jfat still doesn't support FAT-16, which is clearly what this disk is if we have fallen back to use the older driver.

Additionally, it probably wouldn't hurt to get a confirmation that similar issues cannot occur on the newer driver.