mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-24 03:02:10 +01:00
GConverterInputStream: fix an infinite loop when fill_buffer returns an error
The loop was using a GConverterResult variable where it meant to use a gssize, and since GConverterResult was ending up as an unsigned type, this meant the (res < 0) check always failed.
This commit is contained in:
parent
2ef1a8ef05
commit
adea9fb252
@ -495,18 +495,18 @@ g_converter_input_stream_read (GInputStream *stream,
|
|||||||
{
|
{
|
||||||
/* Need more data */
|
/* Need more data */
|
||||||
my_error2 = NULL;
|
my_error2 = NULL;
|
||||||
res = fill_input_buffer (cstream,
|
nread = fill_input_buffer (cstream,
|
||||||
buffer_data_size (&priv->input_buffer) + 4096,
|
buffer_data_size (&priv->input_buffer) + 4096,
|
||||||
cancellable,
|
cancellable,
|
||||||
&my_error2);
|
&my_error2);
|
||||||
if (res < 0)
|
if (nread < 0)
|
||||||
{
|
{
|
||||||
/* Can't read any more data, return that error */
|
/* Can't read any more data, return that error */
|
||||||
g_error_free (my_error);
|
g_error_free (my_error);
|
||||||
g_propagate_error (error, my_error2);
|
g_propagate_error (error, my_error2);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
else if (res == 0)
|
else if (nread == 0)
|
||||||
{
|
{
|
||||||
/* End of file, try INPUT_AT_END */
|
/* End of file, try INPUT_AT_END */
|
||||||
priv->at_input_end = TRUE;
|
priv->at_input_end = TRUE;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user