gfileutils: Fix a potential integer overflow
commit33dd6d12d7478df22b7759f0ed26f81187ad2a54
authorPhilip Withnall <philip.withnall@collabora.co.uk>
Mon, 25 Nov 2013 14:06:01 +0000 (25 14:06 +0000)
committerPhilip Withnall <philip.withnall@collabora.co.uk>
Wed, 27 Nov 2013 10:05:56 +0000 (27 10:05 +0000)
treec71453499b802127c7a175f4397b1db242994f63
parentc1d5db618688a78aa897d269859a1bc6413a9e55
gfileutils: Fix a potential integer overflow

When calculating the array sizes in get_contents_stdio(), there is a
possibility of overflow for very large files. Rearrange the overflow
checks to avoid this.

The code already handled some possibilities of files being too large, so
no new GError has been added to handle this; the existing
G_FILE_ERROR_FAILED is re-used.

Found by scan-build.

https://bugzilla.gnome.org/show_bug.cgi?id=715164
glib/gfileutils.c