ruby-changes:43405
From: naruse <ko1@a...>
Date: Tue, 21 Jun 2016 16:14:10 +0900 (JST)
Subject: [ruby-changes:43405] naruse:r55479 (trunk): * string.c (rb_str_casemap): int is too small for string size.
naruse 2016-06-21 16:14:04 +0900 (Tue, 21 Jun 2016) New Revision: 55479 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=55479 Log: * string.c (rb_str_casemap): int is too small for string size. Modified files: trunk/ChangeLog trunk/string.c Index: string.c =================================================================== --- string.c (revision 55478) +++ string.c (revision 55479) @@ -5773,7 +5773,7 @@ rb_str_casemap(VALUE source, OnigCaseFol https://github.com/ruby/ruby/blob/trunk/string.c#L5773 int target_length = 0; mapping_buffer pre_buffer, /* only next pointer used */ *current_buffer = &pre_buffer; - int buffer_count = 0; + size_t buffer_count = 0; int buffer_length_or_invalid; if (RSTRING_LEN(source) == 0) return rb_str_dup(source); @@ -5783,7 +5783,7 @@ rb_str_casemap(VALUE source, OnigCaseFol https://github.com/ruby/ruby/blob/trunk/string.c#L5783 while (source_current < source_end) { /* increase multiplier using buffer count to converge quickly */ - int capa = (int)(source_end-source_current)*++buffer_count + CASE_MAPPING_ADDITIONAL_LENGTH; + size_t capa = (size_t)(source_end-source_current)*++buffer_count + CASE_MAPPING_ADDITIONAL_LENGTH; /* fprintf(stderr, "Buffer allocation, capa is %d\n", capa); *//* for tuning */ current_buffer->next = (mapping_buffer*)ALLOC_N(char, sizeof(mapping_buffer)+capa); current_buffer = current_buffer->next; Index: ChangeLog =================================================================== --- ChangeLog (revision 55478) +++ ChangeLog (revision 55479) @@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Tue Jun 21 16:12:21 2016 NARUSE, Yui <naruse@r...> + + * string.c (rb_str_casemap): int is too small for string size. + Tue Jun 21 15:42:22 2016 Martin Duerst <duerst@i...> * test/ruby/test_in.rb: Skip test_read_buffer_error on cygwin, -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/