gio: Prevent hang writing to a large GMemoryOutputStream
authorRoss Lagerwall <rosslagerwall@gmail.com>
Wed, 29 Oct 2014 22:05:32 +0000 (22:05 +0000)
committerRoss Lagerwall <rosslagerwall@gmail.com>
Thu, 30 Oct 2014 20:15:47 +0000 (20:15 +0000)
commit5a6f13d16f38ea0a6c9d48332b7e3932b7f3b7d4
tree78b7d8404dcc02339d6630f4767d987e85e3275e
parentb3e3ed73864143e732c4d65441eaec086a3ab83e
gio: Prevent hang writing to a large GMemoryOutputStream

Fix a hang due to overflow by using unsigned numbers and explicitly
checking if the number overflows to zero.  This also fixes the previous
logic which assigned an int which may be negative to an unsigned number
resulting in sign extension and strange results.

Use gsize rather than int to allow for large streams on 64 bit machines.

https://bugzilla.gnome.org/show_bug.cgi?id=727988
gio/gmemoryoutputstream.c