Skip to content

Commit

Permalink
Limit input size to SIZE_MAX/2.
Browse files Browse the repository at this point in the history
  • Loading branch information
xitology committed Feb 3, 2014
1 parent c201bf6 commit c9479c7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/reader.c
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,10 @@ yaml_parser_update_buffer(yaml_parser_t *parser, size_t length)

}

if (parser->offset >= PTRDIFF_MAX)
return yaml_parser_set_reader_error(parser, "input is too long",
PTRDIFF_MAX, -1);

return 1;
}

1 change: 1 addition & 0 deletions src/yaml_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <assert.h>
#include <limits.h>
#include <stddef.h>
#include <stdint.h>

/*
* Memory management.
Expand Down

0 comments on commit c9479c7

Please sign in to comment.