summaryrefslogtreecommitdiff
path: root/ext/psych/yaml/scanner.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-02-05 01:17:28 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-02-05 01:17:28 +0000
commit990ba47c24a47dbe428c993b4fb155b90cfd8ab0 (patch)
treef0163c8f00a505c5d2b91b08bdddde6933c2466e /ext/psych/yaml/scanner.c
parent0483b29a8bc3a08d22f1c10c583350d29d56c6b3 (diff)
yaml/api.c, yaml/loader.c: integer overflow
* ext/psych/yaml/api.c (yaml_scalar_event_initialize): fix possible integer overflow. (yaml_document_add_scalar): ditto. (yaml_document_add_sequence): ditto. (yaml_document_add_mapping): ditto. * ext/psych/yaml/loader.c (yaml_parser_load_scalar): ditto. (yaml_parser_load_sequence): ditto. (yaml_parser_load_mapping): ditto. * ext/psych/yaml/scanner.c (yaml_parser_roll_indent): suppress warnigs. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44816 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/psych/yaml/scanner.c')
-rw-r--r--ext/psych/yaml/scanner.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/ext/psych/yaml/scanner.c b/ext/psych/yaml/scanner.c
index e80ec5ae6a..2ca3fed62f 100644
--- a/ext/psych/yaml/scanner.c
+++ b/ext/psych/yaml/scanner.c
@@ -1231,12 +1231,14 @@ yaml_parser_roll_indent(yaml_parser_t *parser, ptrdiff_t column,
if (!PUSH(parser, parser->indents, parser->indent))
return 0;
+#if PTRDIFF_MAX > INT_MAX
if (column > INT_MAX) {
parser->error = YAML_MEMORY_ERROR;
return 0;
}
+#endif
- parser->indent = column;
+ parser->indent = (int)column;
/* Create a token and insert it into the queue. */