SheetJS/js-cfb

Infinite loop in build_full_paths with some files

rossj opened this issue · 2 comments

rossj commented

I've run into a file that enters an infinite loop with my changes in PR #6, even with your additional loop fix in commit 8d85fb6. The infinite loop doesn't happen in previous version 1.1.0.

I believe the dad tree for this file is constructed a bit incorrectly, thus it has a loop in it. I haven't looked into fixing the dad tree, but I did manage to avoid the infinite loop by slightly changing the final naming loop to:

	for(i=1; i < pl; ++i) {
		if(FI[i].type === 0 /* unknown */) continue;
		if (i !== dad[i]) {
			j = i;
			do {
				j = dad[j];
				FP[i] = FP[j] + "/" + FP[i];
			} while (j !== 0 && -1 !== dad[j] && j != dad[j]);
		}
		dad[i] = -1;
	}

I'm unable to share the file publicly, but I can email it if you would like.

Please share the file (dev@sheetjs.com)

The latest update should have fixed the issue, please reopen if that is not the case