diff options
Diffstat (limited to 'src/api.c')
-rw-r--r-- | src/api.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/api.c b/src/api.c index 0c4732e1520d..68bc2d8e9b0b 100644 --- a/src/api.c +++ b/src/api.c @@ -117,7 +117,12 @@ yaml_string_join( YAML_DECLARE(int) yaml_stack_extend(void **start, void **top, void **end) { - void *new_start = yaml_realloc(*start, ((char *)*end - (char *)*start)*2); + void *new_start; + + if ((char *)*end - (char *)*start >= INT_MAX / 2) + return 0; + + new_start = yaml_realloc(*start, ((char *)*end - (char *)*start)*2); if (!new_start) return 0; |