Issue #1682 - Segfault when starting GIMP, due to empty data files
Use gimp_input_data_stream_read_line_always(), instead of
g_input_data_stream_read_line(), in a bunch of places that don't
expect EOF. If we don't do that, the code assumes the GError
parameter is set by the function and returns an error indication,
causing the caller to segfault when it tries to access
error->message. Instead, we now process an empty line when EOF is
reached, which is caught by the normal parsing logic.
Additionally:
- Use gimp_ascii_strto[id]() when loading gradients, generated
brushes, and palettes, to improve error checking for invalid
numeric input.
- Improve gradient-segment endpoint consistency check.
- Allow loading palette files with 0 colors. They can be created
during the session, so we might as well successfully load them.
(cherry picked from commit 993bbd354e
)
This commit is contained in:
@ -31,6 +31,7 @@
|
||||
|
||||
#include "operations-types.h"
|
||||
|
||||
#include "core/gimp-utils.h"
|
||||
#include "core/gimpcurve.h"
|
||||
#include "core/gimphistogram.h"
|
||||
|
||||
@ -537,8 +538,8 @@ gimp_curves_config_load_cruft (GimpCurvesConfig *config,
|
||||
data_input = g_data_input_stream_new (input);
|
||||
|
||||
line_len = 64;
|
||||
line = g_data_input_stream_read_line (data_input, &line_len,
|
||||
NULL, error);
|
||||
line = gimp_data_input_stream_read_line_always (data_input, &line_len,
|
||||
NULL, error);
|
||||
if (! line)
|
||||
return FALSE;
|
||||
|
||||
|
@ -33,6 +33,7 @@
|
||||
|
||||
#include "operations-types.h"
|
||||
|
||||
#include "core/gimp-utils.h"
|
||||
#include "core/gimpcurve.h"
|
||||
#include "core/gimphistogram.h"
|
||||
|
||||
@ -831,8 +832,8 @@ gimp_levels_config_load_cruft (GimpLevelsConfig *config,
|
||||
data_input = g_data_input_stream_new (input);
|
||||
|
||||
line_len = 64;
|
||||
line = g_data_input_stream_read_line (data_input, &line_len,
|
||||
NULL, error);
|
||||
line = gimp_data_input_stream_read_line_always (data_input, &line_len,
|
||||
NULL, error);
|
||||
if (! line)
|
||||
return FALSE;
|
||||
|
||||
@ -854,8 +855,8 @@ gimp_levels_config_load_cruft (GimpLevelsConfig *config,
|
||||
gint fields;
|
||||
|
||||
line_len = 64;
|
||||
line = g_data_input_stream_read_line (data_input, &line_len,
|
||||
NULL, error);
|
||||
line = gimp_data_input_stream_read_line_always (data_input, &line_len,
|
||||
NULL, error);
|
||||
if (! line)
|
||||
{
|
||||
g_object_unref (data_input);
|
||||
|
Reference in New Issue
Block a user