diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-06-21 07:14:04 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-06-21 07:14:04 +0000 |
commit | 0a750c2604541be795129ddf985637f0e067460e (patch) | |
tree | 0f44640f9b94839e521d067821863e6ac73bd834 /string.c | |
parent | 27da175fdc14f972d40f6296b8166976740e6319 (diff) | |
download | ruby-0a750c2604541be795129ddf985637f0e067460e.tar.gz |
* string.c (rb_str_casemap): int is too small for string size.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55479 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r-- | string.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -5773,7 +5773,7 @@ rb_str_casemap(VALUE source, OnigCaseFoldType *flags, rb_encoding *enc) 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, OnigCaseFoldType *flags, rb_encoding *enc) 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; |