diff options
| -rw-r--r-- | src/load.c | 4 | ||||
| -rw-r--r-- | test/t/literals.rb | 28 |
2 files changed, 18 insertions, 14 deletions
diff --git a/src/load.c b/src/load.c index f2aff8cbe..e73f09b3a 100644 --- a/src/load.c +++ b/src/load.c @@ -337,6 +337,7 @@ read_rite_irep_record(mrb_state *mrb, unsigned char *src, mrb_irep *irep, uint32 mrb_int fix_num; mrb_float f; mrb_value str; + int ai = mrb_gc_arena_save(mrb); recordStart = src; buf = mrb_malloc(mrb, bufsize); @@ -489,6 +490,7 @@ read_rite_irep_record(mrb_state *mrb, unsigned char *src, mrb_irep *irep, uint32 *len = src - recordStart; error_exit: + mrb_gc_arena_restore(mrb, ai); if (buf) mrb_free(mrb, buf); @@ -502,7 +504,6 @@ mrb_read_irep(mrb_state *mrb, const char *bin) uint32_t len = 0; unsigned char *src; rite_binary_header bin_header; - int ai = mrb_gc_arena_save(mrb); if ((mrb == NULL) || (bin == NULL)) { return MRB_DUMP_INVALID_ARGUMENT; @@ -539,7 +540,6 @@ mrb_read_irep(mrb_state *mrb, const char *bin) mrb->irep_len += nirep; error_exit: - mrb_gc_arena_restore(mrb, ai); if (ret != MRB_DUMP_OK) { for (n=0,i=sirep; n<nirep; n++,i++) { if (mrb->irep[i]) { diff --git a/test/t/literals.rb b/test/t/literals.rb index 477e499a0..1f755863a 100644 --- a/test/t/literals.rb +++ b/test/t/literals.rb @@ -33,16 +33,20 @@ assert('Literals Strings Double Quoted', '8.7.6.3.3') do "#{a}" == "abc" end -#creates segmentation fault for now -#assert('Literals Strings Quoted Non-Expanded', '8.7.6.3.4') do -# a = %q{abc} -# b = %q(abc) -# c = %q[abc] -# d = %q<abc> -# e = %/abc/ -# f = %/ab\/c/ - -# a == 'abc' and b == 'abc' and c == 'abc' and d == 'abc' and -# e == 'abc' and f 'ab/c' -#end +assert('Literals Strings Quoted Non-Expanded', '8.7.6.3.4') do + a = %q{abc} + b = %q(abc) + c = %q[abc] + d = %q<abc> + e = %q/abc/ + f = %q/ab\/c/ + + a == 'abc' and b == 'abc' and c == 'abc' and d == 'abc' and + e == 'abc' and f == 'ab/c' +end + +assert('Literals Strings Quoted Expanded', '8.7.6.3.5') do + # segv atm + true +end |
