I found an error when I try to mount a 6g dvd, the problem is that the function httpfs_stat cast the resut to int for off_t,
here is my patch
--- httpfs2.c.org 2016-02-25 15:22:02.355469804 -0600
+++ httpfs2.c 2016-02-25 15:22:14.935469406 -0600
@@ -186,7 +186,7 @@
* The FUSE operations originally ripped from the hello_ll sample.
*/
-static int httpfs_stat(fuse_ino_t ino, struct stat stbuf)
+static off_t httpfs_stat(fuse_ino_t ino, struct stat stbuf)
{
stbuf->st_ino = ino;
switch (ino) {
@@ -199,7 +199,7 @@
struct_url * url = thread_setup();
stbuf->st_mode = S_IFREG | 0444;
stbuf->st_nlink = 1;
- return (int) get_stat(url, stbuf);
+ return get_stat(url, stbuf);
}; break;
default:
This patch is very helpful!
I would suggest to merge this patch.
For example, I have 300GB disk image file.
It's size is
316878911488
in byte number.In hex it is
0x49C7747800L
.Casting this to integer may cause overflow or underflow.
And the casted result becomes
0xC7747800
(ifint
is 32-bit width).This is a negative number:
-948668416
.httpfs_stat
will return negative number, and thenhttpfs_lookup
orhttpfs_getattr
will fail as it gets< 0
value.