summaryrefslogtreecommitdiffhomepage
path: root/src/dump.c
diff options
context:
space:
mode:
authorYukihiro Matz Matsumoto <[email protected]>2013-03-14 19:09:55 +0900
committerYukihiro Matz Matsumoto <[email protected]>2013-03-14 19:09:55 +0900
commit93e9174c57709e6867459c55fb88149234483c1d (patch)
tree047d8012baa268086ce1bc99fbb9308ed8754980 /src/dump.c
parentb75805b15ec46cbcd7561ffd571e2c892de96f25 (diff)
downloadmruby-93e9174c57709e6867459c55fb88149234483c1d.tar.gz
mruby-93e9174c57709e6867459c55fb88149234483c1d.zip
symbol length make size_t from mrb_int; cancel #993 monaka/pr-cleanup-symbol.c-20130312
Diffstat (limited to 'src/dump.c')
-rw-r--r--src/dump.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/dump.c b/src/dump.c
index ba5a69a56..9666f7562 100644
--- a/src/dump.c
+++ b/src/dump.c
@@ -279,7 +279,7 @@ get_syms_block_size(mrb_state *mrb, mrb_irep *irep, int type)
size += DUMP_SIZE(MRB_DUMP_SIZE_OF_SHORT, type); /* snl(n) */
if (irep->syms[sym_no] != 0) {
- int len;
+ size_t len;
name = mrb_sym2name_len(mrb, irep->syms[sym_no], &len);
nlen = str_dump_len((char*)name, len, type);
@@ -421,9 +421,10 @@ write_syms_block(mrb_state *mrb, mrb_irep *irep, char *buf, int type)
uint16_t nlen =0;
if (irep->syms[sym_no] != 0) {
- int len;
+ size_t len;
name = mrb_sym2name_len(mrb, irep->syms[sym_no], &len);
+ if (len > UINT16_MAX) goto error_exit;
nlen = str_dump_len((char*)name, len, type);
if ( nlen > buf_size - 1) {
buf_size = nlen + 1;