Inkview refuses to open a SVG file with a large inode number

Bug #1516964 reported by Nutchanon Wetchasit
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Inkscape
New
Medium
Unassigned

Bug Description

I have stumbled into a weird bug that Inkview refuses to open a random SVG
file on a Samba-mounted filesystem (`/mnt/wspace` is on remote machine):

$ inkview /mnt/wspace/illustrations/random/bucket.svg
could not open file /mnt/wspace/illustrations/random/bucket.svg
$

This file can be opened normally with Inkscape, or other programs like
Eye of MATE, GNOME rsvg-view-3, and Debian Iceweasel. If the file was
copied to local filesystem first, Inkview will also open it successfully.

This SVG file was created using Inkscape 0.46-2.lenny2 (from Debian GNU/Linux
5.0 "Lenny" i386), and is also attached for reference.

The remote filesystem in question is FAT32, exported from a machine running
Windows XP Professional SP3 via SMB protocol.

Inkscape: 0.48.3.1-1.3 (debian)
Samba: 2:3.6.6-6+deb7u4 (debian)
cifs-utils: 2:5.5-1 (debian)
System: Debian GNU/Linux 7.0 "Wheezy" i386

Revision history for this message
Nutchanon Wetchasit (nutchanon-wetchasit) wrote :
Revision history for this message
Nutchanon Wetchasit (nutchanon-wetchasit) wrote :

A closer look on Inkview source code (both current rev 14476 16-Nov-2015 and
0.48.3.1-1.3 debian) shows that the error message is rooted from a `stat()`
call check in `main()` function that is used for pre-checking that the file could be opened:
http://bazaar.launchpad.net/~inkscape.dev/inkscape/trunk/view/head:/src/inkview.cpp#L240

I have used `stat` command on the file, and found nothing particularly striking:

$ stat /mnt/wspace/illustrations/random/bucket.svg
  File: `/mnt/wspace/illustrations/random/bucket.svg'
  Size: 6191 Blocks: 32 IO Block: 16384 regular file
Device: 13h/19d Inode: 26540031872 Links: 1
Access: (0666/-rw-rw-rw-) Uid: ( 1000/ window) Gid: ( 1000/ window)
Access: 2014-11-19 00:00:00.000000000 +0700
Modify: 2014-06-02 16:42:26.000000000 +0700
Change: 1940-10-24 09:26:18.955161600 +0700
 Birth: -
$

So I wrote a simple C program that imitate how Inkview uses `stat()` call:

$ ./teststat /mnt/wspace/illustrations/random/bucket.svg
teststat: stat failed: Value too large for defined data type
$

From the result, it seems that the issue is simply triggered by a large
inode number (>2147483647), which choked `stat()` on a 32-bit Inkview build
(which doesn't use `_FILE_OFFSET_BITS=64` macro). The file itself could still
be opened using a normal `open()` call, and this seems to be the reason
that Inkscape itself is not affected.

This sample `teststat` C program is also attached.

Note: I have searched entire current Inkscape/Inkview code, and found neither
`_LARGEFILE64_SOURCE` nor `_FILE_OFFSET_BITS`, so I assume that they are not used.

Inkscape: 0.48.3.1-1.3 (debian)
Samba: 2:3.6.6-6+deb7u4 (debian)
cifs-utils: 2:5.5-1 (debian)
System: Debian GNU/Linux 7.0 "Wheezy" i386

su_v (suv-lp)
tags: added: inkview
jazzynico (jazzynico)
tags: added: code-design
Changed in inkscape:
importance: Undecided → Medium
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.