Mercurial > vim
comparison src/vim9compile.c @ 19785:99248f0ff29d v8.2.0449
patch 8.2.0449: Vim9: crash if return type is invalid
Commit: https://github.com/vim/vim/commit/cf3f8bf4ddfbc0f5ce53f0c9270dc15567f4feea
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Mar 26 13:15:42 2020 +0100
patch 8.2.0449: Vim9: crash if return type is invalid
Problem: Vim9: crash if return type is invalid. (Yegappan Lakshmanan)
Solution: Always return some type, not NULL.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 26 Mar 2020 13:30:04 +0100 |
parents | 9daed26b788b |
children | c1c88b333481 |
comparison
equal
deleted
inserted
replaced
19784:39dbaf2eec63 | 19785:99248f0ff29d |
---|---|
1373 { | 1373 { |
1374 if (*skipwhite(*arg) == '<') | 1374 if (*skipwhite(*arg) == '<') |
1375 emsg(_("E1007: No white space allowed before <")); | 1375 emsg(_("E1007: No white space allowed before <")); |
1376 else | 1376 else |
1377 emsg(_("E1008: Missing <type>")); | 1377 emsg(_("E1008: Missing <type>")); |
1378 return NULL; | 1378 return type; |
1379 } | 1379 } |
1380 *arg = skipwhite(*arg + 1); | 1380 *arg = skipwhite(*arg + 1); |
1381 | 1381 |
1382 member_type = parse_type(arg, type_list); | 1382 member_type = parse_type(arg, type_list); |
1383 if (member_type == NULL) | 1383 if (member_type == NULL) |
1384 return NULL; | 1384 return type; |
1385 | 1385 |
1386 *arg = skipwhite(*arg); | 1386 *arg = skipwhite(*arg); |
1387 if (**arg != '>') | 1387 if (**arg != '>') |
1388 { | 1388 { |
1389 emsg(_("E1009: Missing > after type")); | 1389 emsg(_("E1009: Missing > after type")); |
1390 return NULL; | 1390 return type; |
1391 } | 1391 } |
1392 ++*arg; | 1392 ++*arg; |
1393 | 1393 |
1394 if (type->tt_type == VAR_LIST) | 1394 if (type->tt_type == VAR_LIST) |
1395 return get_list_type(member_type, type_list); | 1395 return get_list_type(member_type, type_list); |