#1 Cannot mount .isos larger than 2G (INT_MAX) on 32-bit arch

closed-fixed
nobody
None
5
2012-09-03
2010-04-30
No

This is on a 32-bit box.The file_size member of the struct_url is a size_t (unsigned int). get_stat returns the file_size as a ssize_t (int) and overflows...this gives you the 'return 3' case in main() for .isos larger than INT_MAX (2147483647).
e.g.
# curl -s --head http://a.b.c.d/stuff/my.iso | grep Length
Content-Length: 2984415232
# ./https2 http://a.b.c.d/stuff/my.iso sdsd
file name: my.iso
host name: a.b.c.d
port number: 80
protocol: http
request path: /stuff/my.iso
auth data: (null)
[root@mas101 ~]# echo $?
3

This fixed it for me..
--- httpfs2.c 2010-03-12 11:42:34.000000000 -0500
+++ httpfs2.c.new 2010-04-30 00:14:22.237522000 -0400
@@ -102,7 +102,7 @@

static struct_url main_url;

-static ssize_t get_stat(struct_url*, struct stat * stbuf);
+static size_t 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 size_t httpfs_stat(fuse_ino_t ino, struct stat *stbuf)
{
stbuf->st_ino = ino;
switch (ino) {
@@ -598,9 +598,9 @@
}
close_client_socket(&main_url);
struct stat st;
- long long size = get_stat(&main_url, &st);
+ size_t size = get_stat(&main_url, &st);
if(size >= 0) {
- fprintf(stderr, "file size: \t%lld\n", size);
+ fprintf(stderr, "file size: \t%u\n", size);
}else{
return 3;
}
@@ -1117,7 +1117,7 @@
* to determine the file size
*/

-static ssize_t get_stat(struct_url *url, struct stat * stbuf) {
+static size_t get_stat(struct_url *url, struct stat * stbuf) {
char buf[HEADER_SIZE];

if( exchange(url, buf, "HEAD", &(url->file_size), 0, 0, 0) < 0 )

Discussion

  • Michal Suchanek

    Michal Suchanek - 2012-09-03
    • status: open --> closed
     
  • Michal Suchanek

    Michal Suchanek - 2012-09-03

    should be fixed in 0.1.5

     
  • Michal Suchanek

    Michal Suchanek - 2012-09-03
    • status: closed --> closed-fixed
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks