commit b9a7d7860d96c077eb0327c6241cd270aa65fd34
parent 0ab680e39b68125158d49ccd728a1f69eba9cb56
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Tue, 8 Oct 2019 11:08:47 +0200
Fix a segfault when the input file is empty
Diffstat:
1 file changed, 5 insertions(+), 0 deletions(-)
diff --git a/src/schiff_args.c b/src/schiff_args.c
@@ -1344,6 +1344,11 @@ parse_yaml
doc_is_init = 1;
root = yaml_document_get_root_node(&doc);
+ if(!root) {
+ fprintf(stderr, "Unexpected empty file `%s'.\n", filename);
+ res = RES_BAD_ARG;
+ goto error;
+ }
if(root->type == YAML_MAPPING_NODE) {
ndistribs = (size_t)
(root->data.mapping.pairs.top - root->data.mapping.pairs.start);