Public bug reported:

Due to the use of size_t for file_size, an overflow occurs if file is
too large. httpfs returns with exitcode 3.

Ive made a fix that works very well in my tests. Tested both with
httpfs2 and httpfs2_ssl.:

--- httpfs2.c.org       2010-03-13 21:07:56.000000000 +0100
+++ httpfs2.c   2011-07-09 16:02:41.000000000 +0200
@@ -96,13 +96,13 @@
 #endif
     char * req_buf;
     size_t req_buf_size;
-    size_t file_size;
+    long long file_size;
     time_t last_modified;
 } struct_url;
 
 static struct_url main_url;
 
-static ssize_t get_stat(struct_url*, struct stat * stbuf);
+static long long get_stat(struct_url*, struct stat * stbuf);
 static ssize_t get_data(struct_url*, off_t start, size_t size);
 static int open_client_socket(struct_url *url);
 static int close_client_socket(struct_url *url);
@@ -185,7 +185,7 @@
  * The FUSE operations originally ripped from the hello_ll sample.
  */
 
-static int httpfs_stat(fuse_ino_t ino, struct stat *stbuf)
+static long long httpfs_stat(fuse_ino_t ino, struct stat *stbuf)
 {
     stbuf->st_ino = ino;
     switch (ino) {
@@ -925,7 +925,7 @@
 
 static ssize_t
 parse_header(struct_url *url, const char * buf, ssize_t bytes,
-        const char * method, size_t * content_length, int expect)
+        const char * method, long long * content_length, int expect)
 {
     /* FIXME check the header parser */
     int status;
@@ -1040,7 +1040,7 @@
 
 static ssize_t
 exchange(struct_url *url, char * buf, const char * method,
-        size_t * content_length, off_t start, off_t end, size_t * 
header_length)
+        long long * content_length, off_t start, off_t end, size_t * 
header_length)
 {
     ssize_t res;
     ssize_t bytes;
@@ -1117,7 +1117,7 @@
  * to determine the file size
  */
 
-static ssize_t get_stat(struct_url *url, struct stat * stbuf) {
+static long long get_stat(struct_url *url, struct stat * stbuf) {
     char buf[HEADER_SIZE];
 
     if( exchange(url, buf, "HEAD", &(url->file_size), 0, 0, 0) < 0 )
@@ -1126,7 +1126,8 @@
     close_client_socket(url);
 
     stbuf->st_mtime = url->last_modified;
-    return stbuf->st_size = url->file_size;
+    stbuf->st_size = url->file_size;
+    return url->file_size;
 }
 
 /*
@@ -1142,7 +1143,8 @@
     ssize_t bytes;
     off_t end = start + size - 1;
     char * destination = url->req_buf;
-    size_t content_length, header_length;
+    long long content_length;
+    size_t header_length;
 
     bytes = exchange(url, buf, "GET", &content_length,
             start, end, &header_length);

ProblemType: Bug
DistroRelease: Ubuntu 10.10
Package: httpfs2 0.1.4-1
ProcVersionSignature: Ubuntu 2.6.35-30.54-generic 2.6.35.13
Uname: Linux 2.6.35-30-generic i686
NonfreeKernelModules: nvidia
Architecture: i386
Date: Sat Jul  9 17:11:15 2011
EcryptfsInUse: Yes
ProcEnviron:
 PATH=(custom, no user)
 LANG=en_DK.utf8
 SHELL=/bin/bash
SourcePackage: httpfs2

** Affects: httpfs2 (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: apport-bug i386 maverick

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/808030

Title:
  httpfs cannot mount larger files (like DVD9)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/httpfs2/+bug/808030/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to