mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-11 15:06:14 +01:00
Ensure we always have some target space in GConverterOutputStream
When the converter fills the whole buffer without reading all input, we need to enlarge the buffer. Otherwise we get an assertion failure for `outbuf_size > 0' in g_converter_convert. https://bugzilla.gnome.org/show_bug.cgi?id=619945
This commit is contained in:
parent
85ea72c0c5
commit
86592d675f
@ -418,6 +418,10 @@ g_converter_output_stream_write (GOutputStream *stream,
|
||||
converted_bytes = 0;
|
||||
while (!priv->finished && converted_bytes < to_convert_size)
|
||||
{
|
||||
/* Ensure we have *some* target space */
|
||||
if (buffer_tailspace (&priv->converted_buffer) == 0)
|
||||
grow_buffer (&priv->converted_buffer);
|
||||
|
||||
/* Try to convert to our buffer */
|
||||
my_error = NULL;
|
||||
res = g_converter_convert (priv->converter,
|
||||
@ -529,6 +533,10 @@ g_converter_output_stream_flush (GOutputStream *stream,
|
||||
flushed = FALSE;
|
||||
while (!priv->finished && !flushed)
|
||||
{
|
||||
/* Ensure we have *some* target space */
|
||||
if (buffer_tailspace (&priv->converted_buffer) == 0)
|
||||
grow_buffer (&priv->converted_buffer);
|
||||
|
||||
/* Try to convert to our buffer */
|
||||
my_error = NULL;
|
||||
res = g_converter_convert (priv->converter,
|
||||
|
Loading…
Reference in New Issue
Block a user