[前][次][番号順一覧][スレッド一覧]

ruby-changes:33081

From: naruse <ko1@a...>
Date: Mon, 24 Feb 2014 13:24:22 +0900 (JST)
Subject: [ruby-changes:33081] naruse:r45160 (ruby_2_1): merge revision(s) 44809, 44811, 44813, 44815, 44816, 44817, 44818, 44918, 45003: [Backport #9482]

naruse	2014-02-24 13:24:15 +0900 (Mon, 24 Feb 2014)

  New Revision: 45160

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=45160

  Log:
    merge revision(s) 44809,44811,44813,44815,44816,44817,44818,44918,45003: [Backport #9482]
    
    * ext/psych/yaml/emitter.c: merge libyaml 0.1.5
    
    * ext/psych/yaml/loader.c: ditto
    
    * ext/psych/yaml/parser.c: ditto
    
    * ext/psych/yaml/reader.c: ditto
    
    * ext/psych/yaml/scanner.c: ditto
    
    * ext/psych/yaml/writer.c: ditto
    
    * ext/psych/yaml/yaml_private.h: ditto
    
    * ext/psych/lib/psych.rb: New release of psych.
    
    * ext/psych/psych.gemspec: ditto

  Modified directories:
    branches/ruby_2_1/
  Modified files:
    branches/ruby_2_1/ChangeLog
    branches/ruby_2_1/ext/psych/lib/psych.rb
    branches/ruby_2_1/ext/psych/psych.gemspec
    branches/ruby_2_1/ext/psych/yaml/api.c
    branches/ruby_2_1/ext/psych/yaml/config.h
    branches/ruby_2_1/ext/psych/yaml/emitter.c
    branches/ruby_2_1/ext/psych/yaml/loader.c
    branches/ruby_2_1/ext/psych/yaml/parser.c
    branches/ruby_2_1/ext/psych/yaml/reader.c
    branches/ruby_2_1/ext/psych/yaml/scanner.c
    branches/ruby_2_1/ext/psych/yaml/yaml_private.h
    branches/ruby_2_1/version.h
Index: ruby_2_1/ChangeLog
===================================================================
--- ruby_2_1/ChangeLog	(revision 45159)
+++ ruby_2_1/ChangeLog	(revision 45160)
@@ -1,3 +1,18 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ChangeLog#L1
+Mon Feb 24 13:05:48 2014  Aaron Patterson <aaron@t...>
+
+	* ext/psych/lib/psych.rb: New release of psych.
+	* ext/psych/psych.gemspec: ditto
+
+Mon Feb 24 13:05:48 2014  Aaron Patterson <aaron@t...>
+
+	* ext/psych/yaml/emitter.c: merge libyaml 0.1.5
+	* ext/psych/yaml/loader.c: ditto
+	* ext/psych/yaml/parser.c: ditto
+	* ext/psych/yaml/reader.c: ditto
+	* ext/psych/yaml/scanner.c: ditto
+	* ext/psych/yaml/writer.c: ditto
+	* ext/psych/yaml/yaml_private.h: ditto
+
 Sat Feb 22 22:26:43 2014  NAKAMURA Usaku  <usa@r...>
 
 	* ext/io/console/console.c (console_dev): need read access for conout$
Index: ruby_2_1/ext/psych/yaml/yaml_private.h
===================================================================
--- ruby_2_1/ext/psych/yaml/yaml_private.h	(revision 45159)
+++ ruby_2_1/ext/psych/yaml/yaml_private.h	(revision 45160)
@@ -10,6 +10,17 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ext/psych/yaml/yaml_private.h#L10
 
 #include <assert.h>
 #include <limits.h>
+#include <stddef.h>
+
+#ifndef _MSC_VER
+#include <stdint.h>
+#else
+#ifdef _WIN64
+#define PTRDIFF_MAX _I64_MAX
+#else
+#define PTRDIFF_MAX INT_MAX
+#endif
+#endif
 
 /*
  * Memory management.
@@ -422,7 +433,14 @@ yaml_queue_extend(void **start, void **h https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ext/psych/yaml/yaml_private.h#L433
      (stack).start = (stack).top = (stack).end = 0)
 
 #define STACK_EMPTY(context,stack)                                              \
-    ((stack).start == (stack).top)
+    ((void)(context),                                                           \
+     ((stack).start == (stack).top))
+
+#define STACK_LIMIT(context,stack,size)                                         \
+    ((stack).top - (stack).start < (size) ?                                     \
+        1 :                                                                     \
+        ((context)->error = YAML_MEMORY_ERROR,                                  \
+         0))
 
 #define PUSH(context,stack,value)                                               \
     (((stack).top != (stack).end                                                \
Index: ruby_2_1/ext/psych/yaml/reader.c
===================================================================
--- ruby_2_1/ext/psych/yaml/reader.c	(revision 45159)
+++ ruby_2_1/ext/psych/yaml/reader.c	(revision 45160)
@@ -460,6 +460,10 @@ yaml_parser_update_buffer(yaml_parser_t https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ext/psych/yaml/reader.c#L460
 
     }
 
+    if (parser->offset >= PTRDIFF_MAX)
+        return yaml_parser_set_reader_error(parser, "input is too long",
+                PTRDIFF_MAX, -1);
+
     return 1;
 }
 
Index: ruby_2_1/ext/psych/yaml/loader.c
===================================================================
--- ruby_2_1/ext/psych/yaml/loader.c	(revision 45159)
+++ ruby_2_1/ext/psych/yaml/loader.c	(revision 45160)
@@ -283,9 +283,12 @@ static int https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ext/psych/yaml/loader.c#L283
 yaml_parser_load_scalar(yaml_parser_t *parser, yaml_event_t *first_event)
 {
     yaml_node_t node;
+    ptrdiff_t node_index;
     int index;
     yaml_char_t *tag = first_event->data.scalar.tag;
 
+    if (!STACK_LIMIT(parser, parser->document->nodes, INT_MAX-1)) goto error;
+
     if (!tag || strcmp((char *)tag, "!") == 0) {
         yaml_free(tag);
         tag = yaml_strdup((yaml_char_t *)YAML_DEFAULT_SCALAR_TAG);
@@ -298,7 +301,11 @@ yaml_parser_load_scalar(yaml_parser_t *p https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ext/psych/yaml/loader.c#L301
 
     if (!PUSH(parser, parser->document->nodes, node)) goto error;
 
-    index = parser->document->nodes.top - parser->document->nodes.start;
+    node_index = parser->document->nodes.top - parser->document->nodes.start;
+#if PTRDIFF_MAX > INT_MAX
+    if (node_index > INT_MAX) goto error;
+#endif
+    index = (int)node_index;
 
     if (!yaml_parser_register_anchor(parser, index,
                 first_event->data.scalar.anchor)) return 0;
@@ -327,8 +334,11 @@ yaml_parser_load_sequence(yaml_parser_t https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ext/psych/yaml/loader.c#L334
         yaml_node_item_t *top;
     } items = { NULL, NULL, NULL };
     int index, item_index;
+    ptrdiff_t node_index;
     yaml_char_t *tag = first_event->data.sequence_start.tag;
 
+    if (!STACK_LIMIT(parser, parser->document->nodes, INT_MAX-1)) goto error;
+
     if (!tag || strcmp((char *)tag, "!") == 0) {
         yaml_free(tag);
         tag = yaml_strdup((yaml_char_t *)YAML_DEFAULT_SEQUENCE_TAG);
@@ -343,7 +353,11 @@ yaml_parser_load_sequence(yaml_parser_t https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ext/psych/yaml/loader.c#L353
 
     if (!PUSH(parser, parser->document->nodes, node)) goto error;
 
-    index = parser->document->nodes.top - parser->document->nodes.start;
+    node_index = parser->document->nodes.top - parser->document->nodes.start;
+#if PTRDIFF_MAX > INT_MAX
+    if (node_index > INT_MAX) goto error;
+#endif
+    index = (int)node_index;
 
     if (!yaml_parser_register_anchor(parser, index,
                 first_event->data.sequence_start.anchor)) return 0;
@@ -351,6 +365,9 @@ yaml_parser_load_sequence(yaml_parser_t https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ext/psych/yaml/loader.c#L365
     if (!yaml_parser_parse(parser, &event)) return 0;
 
     while (event.type != YAML_SEQUENCE_END_EVENT) {
+        if (!STACK_LIMIT(parser,
+                    parser->document->nodes.start[index-1].data.sequence.items,
+                    INT_MAX-1)) return 0;
         item_index = yaml_parser_load_node(parser, &event);
         if (!item_index) return 0;
         if (!PUSH(parser,
@@ -384,9 +401,12 @@ yaml_parser_load_mapping(yaml_parser_t * https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ext/psych/yaml/loader.c#L401
         yaml_node_pair_t *top;
     } pairs = { NULL, NULL, NULL };
     int index;
+    ptrdiff_t node_index;
     yaml_node_pair_t pair;
     yaml_char_t *tag = first_event->data.mapping_start.tag;
 
+    if (!STACK_LIMIT(parser, parser->document->nodes, INT_MAX-1)) goto error;
+
     if (!tag || strcmp((char *)tag, "!") == 0) {
         yaml_free(tag);
         tag = yaml_strdup((yaml_char_t *)YAML_DEFAULT_MAPPING_TAG);
@@ -401,7 +421,11 @@ yaml_parser_load_mapping(yaml_parser_t * https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ext/psych/yaml/loader.c#L421
 
     if (!PUSH(parser, parser->document->nodes, node)) goto error;
 
-    index = parser->document->nodes.top - parser->document->nodes.start;
+    node_index = parser->document->nodes.top - parser->document->nodes.start;
+#if PTRDIFF_MAX > INT_MAX
+    if (node_index > INT_MAX) goto error;
+#endif
+    index = (int)node_index;
 
     if (!yaml_parser_register_anchor(parser, index,
                 first_event->data.mapping_start.anchor)) return 0;
@@ -409,6 +433,9 @@ yaml_parser_load_mapping(yaml_parser_t * https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ext/psych/yaml/loader.c#L433
     if (!yaml_parser_parse(parser, &event)) return 0;
 
     while (event.type != YAML_MAPPING_END_EVENT) {
+        if (!STACK_LIMIT(parser,
+                    parser->document->nodes.start[index-1].data.mapping.pairs,
+                    INT_MAX-1)) return 0;
         pair.key = yaml_parser_load_node(parser, &event);
         if (!pair.key) return 0;
         if (!yaml_parser_parse(parser, &event)) return 0;
Index: ruby_2_1/ext/psych/yaml/api.c
===================================================================
--- ruby_2_1/ext/psych/yaml/api.c	(revision 45159)
+++ ruby_2_1/ext/psych/yaml/api.c	(revision 45160)
@@ -395,7 +395,7 @@ yaml_emitter_delete(yaml_emitter_t *emit https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ext/psych/yaml/api.c#L395
     }
     QUEUE_DEL(emitter, emitter->events);
     STACK_DEL(emitter, emitter->indents);
-    while (!STACK_EMPTY(empty, emitter->tag_directives)) {
+    while (!STACK_EMPTY(emitter, emitter->tag_directives)) {
         yaml_tag_directive_t tag_directive = POP(emitter, emitter->tag_directives);
         yaml_free(tag_directive.handle);
         yaml_free(tag_directive.prefix);
@@ -822,6 +822,7 @@ yaml_scalar_event_initialize(yaml_event_ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ext/psych/yaml/api.c#L822
     yaml_char_t *anchor_copy = NULL;
     yaml_char_t *tag_copy = NULL;
     yaml_char_t *value_copy = NULL;
+    size_t value_length;
 
     assert(event);      /* Non-NULL event object is expected. */
     assert(value);      /* Non-NULL anchor is expected. */
@@ -839,16 +840,19 @@ yaml_scalar_event_initialize(yaml_event_ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ext/psych/yaml/api.c#L840
     }
 
     if (length < 0) {
-        length = strlen((char *)value);
+        value_length = strlen((char *)value);
+    }
+    else {
+        value_length = (size_t)length;
     }
 
-    if (!yaml_check_utf8(value, length)) goto error;
-    value_copy = yaml_malloc(length+1);
+    if (!yaml_check_utf8(value, value_length)) goto error;
+    value_copy = yaml_malloc(value_length+1);
     if (!value_copy) goto error;
-    memcpy(value_copy, value, length);
-    value_copy[length] = '\0';
+    memcpy(value_copy, value, value_length);
+    value_copy[value_length] = '\0';
 
-    SCALAR_EVENT_INIT(*event, anchor_copy, tag_copy, value_copy, length,
+    SCALAR_EVENT_INIT(*event, anchor_copy, tag_copy, value_copy, value_length,
             plain_implicit, quoted_implicit, style, mark, mark);
 
     return 1;
@@ -1202,6 +1206,8 @@ yaml_document_add_scalar(yaml_document_t https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ext/psych/yaml/api.c#L1206
     yaml_char_t *tag_copy = NULL;
     yaml_char_t *value_copy = NULL;
     yaml_node_t node;
+    size_t value_length;
+    ptrdiff_t ret;
 
     assert(document);   /* Non-NULL document object is expected. */
     assert(value);      /* Non-NULL value is expected. */
@@ -1215,19 +1221,26 @@ yaml_document_add_scalar(yaml_document_t https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ext/psych/yaml/api.c#L1221
     if (!tag_copy) goto error;
 
     if (length < 0) {
-        length = strlen((char *)value);
+        value_length = strlen((char *)value);
+    }
+    else {
+        value_length = (size_t)length;
     }
 
-    if (!yaml_check_utf8(value, length)) goto error;
-    value_copy = yaml_malloc(length+1);
+    if (!yaml_check_utf8(value, value_length)) goto error;
+    value_copy = yaml_malloc(value_length+1);
     if (!value_copy) goto error;
-    memcpy(value_copy, value, length);
-    value_copy[length] = '\0';
+    memcpy(value_copy, value, value_length);
+    value_copy[value_length] = '\0';
 
-    SCALAR_NODE_INIT(node, tag_copy, value_copy, length, style, mark, mark);
+    SCALAR_NODE_INIT(node, tag_copy, value_copy, value_length, style, mark, mark);
     if (!PUSH(&context, document->nodes, node)) goto error;
 
-    return document->nodes.top - document->nodes.start;
+    ret = document->nodes.top - document->nodes.start;
+#if PTRDIFF_MAX > INT_MAX
+    if (ret > INT_MAX) goto error;
+#endif
+    return (int)ret;
 
 error:
     yaml_free(tag_copy);
@@ -1255,6 +1268,7 @@ yaml_document_add_sequence(yaml_document https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ext/psych/yaml/api.c#L1268
         yaml_node_item_t *top;
     } items = { NULL, NULL, NULL };
     yaml_node_t node;
+    ptrdiff_t ret;
 
     assert(document);   /* Non-NULL document object is expected. */
 
@@ -1272,7 +1286,11 @@ yaml_document_add_sequence(yaml_document https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ext/psych/yaml/api.c#L1286
             style, mark, mark);
     if (!PUSH(&context, document->nodes, node)) goto error;
 
-    return document->nodes.top - document->nodes.start;
+    ret = document->nodes.top - document->nodes.start;
+#if PTRDIFF_MAX > INT_MAX
+    if (ret > INT_MAX) goto error;
+#endif
+    return (int)ret;
 
 error:
     STACK_DEL(&context, items);
@@ -1300,6 +1318,7 @@ yaml_document_add_mapping(yaml_document_ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ext/psych/yaml/api.c#L1318
         yaml_node_pair_t *top;
     } pairs = { NULL, NULL, NULL };
     yaml_node_t node;
+    ptrdiff_t ret;
 
     assert(document);   /* Non-NULL document object is expected. */
 
@@ -1317,7 +1336,11 @@ yaml_document_add_mapping(yaml_document_ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ext/psych/yaml/api.c#L1336
             style, mark, mark);
     if (!PUSH(&context, document->nodes, node)) goto error;
 
-    return document->nodes.top - document->nodes.start;
+    ret = document->nodes.top - document->nodes.start;
+#if PTRDIFF_MAX > INT_MAX
+    if (ret > INT_MAX) goto error;
+#endif
+    return (int)ret;
 
 error:
     STACK_DEL(&context, pairs);
Index: ruby_2_1/ext/psych/yaml/emitter.c
===================================================================
--- ruby_2_1/ext/psych/yaml/emitter.c	(revision 45159)
+++ ruby_2_1/ext/psych/yaml/emitter.c	(revision 45160)
@@ -53,7 +53,7 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ext/psych/yaml/emitter.c#L53
 #define WRITE_BREAK(emitter,string)                                             \
     (FLUSH(emitter)                                                             \
      && (CHECK(string,'\n') ?                                                   \
-         (PUT_BREAK(emitter),                                                   \
+         ((void)PUT_BREAK(emitter),                                             \
           string.pointer ++,                                                    \
           1) :                                                                  \
          (COPY(emitter->buffer,string),                                         \
@@ -1493,7 +1493,7 @@ yaml_emitter_analyze_scalar(yaml_emitter https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ext/psych/yaml/emitter.c#L1493
     int break_space = 0;
     int space_break = 0;
 
-    int preceded_by_whitespace = 0;
+    int preceeded_by_whitespace = 0;
     int followed_by_whitespace = 0;
     int previous_space = 0;
     int previous_break = 0;
@@ -1524,7 +1524,7 @@ yaml_emitter_analyze_scalar(yaml_emitter https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ext/psych/yaml/emitter.c#L1524
         flow_indicators = 1;
     }
 
-    preceded_by_whitespace = 1;
+    preceeded_by_whitespace = 1;
     followed_by_whitespace = IS_BLANKZ_AT(string, WIDTH(string));
 
     while (string.pointer != string.end)
@@ -1570,7 +1570,7 @@ yaml_emitter_analyze_scalar(yaml_emitter https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ext/psych/yaml/emitter.c#L1570
                 }
             }
 
-            if (CHECK(string, '#') && preceded_by_whitespace) {
+            if (CHECK(string, '#') && preceeded_by_whitespace) {
                 flow_indicators = 1;
                 block_indicators = 1;
             }
@@ -1619,7 +1619,7 @@ yaml_emitter_analyze_scalar(yaml_emitter https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ext/psych/yaml/emitter.c#L1619
             previous_break = 0;
         }
 
-        preceded_by_whitespace = IS_BLANKZ(string);
+        preceeded_by_whitespace = IS_BLANKZ(string);
         MOVE(string);
         if (string.pointer != string.end) {
             followed_by_whitespace = IS_BLANKZ_AT(string, WIDTH(string));
Index: ruby_2_1/ext/psych/yaml/scanner.c
===================================================================
--- ruby_2_1/ext/psych/yaml/scanner.c	(revision 45159)
+++ ruby_2_1/ext/psych/yaml/scanner.c	(revision 45160)
@@ -615,11 +615,11 @@ yaml_parser_decrease_flow_level(yaml_par https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ext/psych/yaml/scanner.c#L615
  */
 
 static int
-yaml_parser_roll_indent(yaml_parser_t *parser, int column,
-        int number, yaml_token_type_t type, yaml_mark_t mark);
+yaml_parser_roll_indent(yaml_parser_t *parser, ptrdiff_t column,
+        ptrdiff_t number, yaml_token_type_t type, yaml_mark_t mark);
 
 static int
-yaml_parser_unroll_indent(yaml_parser_t *parser, int column);
+yaml_parser_unroll_indent(yaml_parser_t *parser, ptrdiff_t column);
 
 /*
  * Token fetchers.
@@ -1103,7 +1103,7 @@ yaml_parser_save_simple_key(yaml_parser_ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ext/psych/yaml/scanner.c#L1103
      */
 
     int required = (!parser->flow_level
-            && parser->indent == (int)parser->mark.column);
+            && parser->indent == (ptrdiff_t)parser->mark.column);
 
     /*
      * A simple key is required only when it is the first token in the current
@@ -1176,6 +1176,11 @@ yaml_parser_increase_flow_level(yaml_par https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ext/psych/yaml/scanner.c#L1176
 
     /* Increase the flow level. */
 
+    if (parser->flow_level == INT_MAX) {
+        parser->error = YAML_MEMORY_ERROR;
+        return 0;
+    }
+
     parser->flow_level++;
 
     return 1;
@@ -1188,11 +1193,9 @@ yaml_parser_increase_flow_level(yaml_par https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ext/psych/yaml/scanner.c#L1193
 static int
 yaml_parser_decrease_flow_level(yaml_parser_t *parser)
 {
-    yaml_simple_key_t dummy_key;    /* Used to eliminate a compiler warning. */
-
     if (parser->flow_level) {
         parser->flow_level --;
-        dummy_key = POP(parser, parser->simple_keys);
+        (void)POP(parser, parser->simple_keys);
     }
 
     return 1;
@@ -1206,8 +1209,8 @@ yaml_parser_decrease_flow_level(yaml_par https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ext/psych/yaml/scanner.c#L1209
  */
 
 static int
-yaml_parser_roll_indent(yaml_parser_t *parser, int column,
-        int number, yaml_token_type_t type, yaml_mark_t mark)
+yaml_parser_roll_indent(yaml_parser_t *parser, ptrdiff_t column,
+        ptrdiff_t number, yaml_token_type_t type, yaml_mark_t mark)
 {
     yaml_token_t token;
 
@@ -1226,7 +1229,14 @@ yaml_parser_roll_indent(yaml_parser_t *p https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ext/psych/yaml/scanner.c#L1229
         if (!PUSH(parser, parser->indents, parser->indent))
             return 0;
 
-        parser->indent = column;
+#if PTRDIFF_MAX > INT_MAX
+        if (column > INT_MAX) {
+            parser->error = YAML_MEMORY_ERROR;
+            return 0;
+        }
+#endif
+
+        parser->indent = (int)column;
 
         /* Create a token and insert it into the queue. */
 
@@ -1248,13 +1258,13 @@ yaml_parser_roll_indent(yaml_parser_t *p https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ext/psych/yaml/scanner.c#L1258
 
 /*
  * Pop indentation levels from the indents stack until the current level
- * becomes less or equal to the column.  For each indentation level, append
+ * becomes less or equal to the column.  For each intendation level, append
  * the BLOCK-END token.
  */
 
 
 static int
-yaml_parser_unroll_indent(yaml_parser_t *parser, int column)
+yaml_parser_unroll_indent(yaml_parser_t *parser, ptrdiff_t column)
 {
     yaml_token_t token;
 
@@ -1263,7 +1273,7 @@ yaml_parser_unroll_indent(yaml_parser_t https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ext/psych/yaml/scanner.c#L1273
     if (parser->flow_level)
         return 1;
 
-    /* Loop through the indentation levels in the stack. */
+    /* Loop through the intendation levels in the stack. */
 
     while (parser->indent > column)
     {
@@ -2574,7 +2584,7 @@ yaml_parser_scan_tag_uri(yaml_parser_t * https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ext/psych/yaml/scanner.c#L2584
 
     /* Resize the string to include the head. */
 
-    while (string.end - string.start <= (int)length) {
+    while ((size_t)(string.end - string.start) <= length) {
         if (!yaml_string_extend(&string.start, &string.pointer, &string.end)) {
             parser->error = YAML_MEMORY_ERROR;
             g (... truncated)

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]