error instead of segfault for invalid/forged brace literals

This commit is contained in:
Alex Shinn 2015-07-05 23:15:45 +09:00
parent 42c14af4b9
commit 1a2b71688d

3
sexp.c
View file

@ -2717,7 +2717,8 @@ sexp sexp_read_raw (sexp ctx, sexp in) {
tmp = sexp_read_error(ctx, "brace literal missing type identifier", sexp_make_character(c1), in);
}
if (!sexp_exceptionp(tmp)) tmp = sexp_lookup_type(ctx, res, tmp);
if (tmp && sexp_typep(tmp) && sexp_opcodep(sexp_type_print(tmp))
if (tmp && sexp_typep(tmp) && sexp_type_print(tmp)
&& sexp_opcodep(sexp_type_print(tmp))
&& sexp_opcode_func(sexp_type_print(tmp)) == (sexp_proc1)sexp_write_simple_object) {
res = sexp_alloc_tagged(ctx, sexp_type_size_base(tmp), sexp_type_tag(tmp));
for (c1=0; ; c1++) {