SerCeMan / jnr-fuse

FUSE implementation in Java using Java Native Runtime (JNR)
MIT License
363 stars 86 forks source link

Invalid path Strings #107

Closed spinkb closed 3 years ago

spinkb commented 3 years ago

jnr-fuse on Windows is not passing a proper Path string to the Java methods. For example, if Windows is asking about "/demo", then jnr-fuse's string comes through corrupt. HEX: 0x2f00640065006d006f00....RANDOM OTHER BYTES FROM THE BUFFER....and eventually text stops.

So whatever text it got, it had a buffer overflow, and wasn't properly UTF8/16(?) processed?

This makes MemoryFS example fail completely 99% of the time, and my own classes failed too. I tried a hack function to work around it stripping out the 0 bytes, but I can't detect the "end" of a String still, so its un-resolvable.

Unfortunately I can't fix the native code...I'm only good for Java. Can someone else track it and fix it? Other OS's don't seem to be affected.

Screenshot from a dump of the path string when windows requested "/demo"

Screen Shot 2020-12-19 at 1 37 19 AM

SerCeMan commented 3 years ago

Hey, @spinkb! Could this issue be related to a different encoding? If yes, I believe these instructions could help https://github.com/SerCeMan/jnr-fuse/blob/master/INSTALLATION.md#windows.

spinkb commented 3 years ago

You are correct. I read that comment 50 times yesterday and thought it applied to something else. Setting the file encoding fixed this, I just wasn't expecting that sort of issue to manifest itself like this. Thanks!

spinkb commented 3 years ago

Closing.