[libgdata] core: Fix crashes on zero-length files
- From: Ondrej Holy <oholy src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgdata] core: Fix crashes on zero-length files
- Date: Tue, 23 Aug 2016 06:37:44 +0000 (UTC)
commit 76e12748bd0e519caeeefd6e1ac7ce8086e63059
Author: Ondrej Holy <oholy redhat com>
Date: Thu Aug 11 08:58:00 2016 +0200
core: Fix crashes on zero-length files
reached_eof is set too early and thus it may not be propagated properly
in some cases, which may cause abortion when reading zero-length files.
https://bugzilla.gnome.org/show_bug.cgi?id=769727
gdata/gdata-buffer.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/gdata/gdata-buffer.c b/gdata/gdata-buffer.c
index c8c1298..ce40f80 100644
--- a/gdata/gdata-buffer.c
+++ b/gdata/gdata-buffer.c
@@ -231,10 +231,6 @@ gdata_buffer_pop_data (GDataBuffer *self, guint8 *data, gsize length_requested,
g_mutex_lock (&(self->mutex));
- /* Set reached_eof */
- if (reached_eof != NULL)
- *reached_eof = self->reached_eof && length_requested >= self->total_length;
-
if (self->reached_eof == TRUE && length_requested > self->total_length) {
/* Return data up to the EOF */
return_length = self->total_length;
@@ -259,6 +255,10 @@ gdata_buffer_pop_data (GDataBuffer *self, guint8 *data, gsize length_requested,
return_length = length_requested;
}
+ /* Set reached_eof */
+ if (reached_eof != NULL)
+ *reached_eof = self->reached_eof && length_requested >= self->total_length;
+
/* Return if we haven't got any data to pop (i.e. if we were cancelled before even one chunk arrived)
*/
if (return_length == 0)
goto done;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]