After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 649246 - g_output_stream_splice() cannot be used on 32-bit machines for splices bigger than 2GB (uses gssize)
g_output_stream_splice() cannot be used on 32-bit machines for splices bigger...
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: gio
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2011-05-03 03:08 UTC by Danielle Madeley
Modified: 2011-07-06 12:40 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
g_output_stream_splice: deal with overflow (2.14 KB, patch)
2011-06-07 21:17 UTC, Dan Winship
committed Details | Review

Description Danielle Madeley 2011-05-03 03:08:03 UTC
g_output_stream_splice_finish() cannot be used on 32-bit machines to do splices bigger than 2GB because it returns a gssize, which will overflow.

This is likely not a problem for general reading and writing, because you are unlikely to be dealing with buffers such a size, but when splicing between a file and a socket, you could be reading for a while and easily wrap past 2GB.
Comment 1 Dan Winship 2011-05-03 09:51:46 UTC
applies to sync version too

so what are you using splice for, and do you find the lack of progress notification to be inconvenient? I was wondering recently if these functions should look more like g_file_copy{,async}()
Comment 2 Danielle Madeley 2011-05-03 22:44:14 UTC
I am splicing from a socket to a file.

File transfers in Telepathy are sent between the client and the Connection Manager via a socket and then from the CM to the network.

When sending or receiving a file, you are given a socket address which you connect to and transfer the file in or out of.

In my specific example I don't need progress notification, because I'm receiving it from the CM, but there are circumstances in which it could be useful.
Comment 3 Dan Winship 2011-06-07 21:17:18 UTC
Created attachment 189433 [details] [review]
g_output_stream_splice: deal with overflow

On 32-bit machines in particular, bytes_written may overflow a gssize.
Notice when that happens and just return G_MAXSSIZE instead.

====

other options would be (a) stop at G_MAXSSIZE and return that, or
(b) stop at G_MAXSSIZE and return -1/G_IO_ERROR_FAILED. None is great,
but a better solution needs new API.
Comment 4 Colin Walters 2011-06-07 22:00:09 UTC
Review of attachment 189433 [details] [review]:

Looks OK to me.
Comment 5 Dan Winship 2011-07-06 12:39:57 UTC
Attachment 189433 [details] pushed as 37ab5ce - g_output_stream_splice: deal with overflow