1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* gc.c (assign_heap_slot): SEGV happens cause on 64-bit platform

sometime there should be `objs-=2` instead of `objs--`.
  patched by Sokolov Yura. https://github.com/ruby/ruby/pull/92

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34597 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nari 2012-02-14 09:11:24 +00:00
parent 52cb46337e
commit 64e7aedcee
2 changed files with 7 additions and 3 deletions

View file

@ -1,3 +1,9 @@
Tue Feb 14 18:07:20 2012 Narihiro Nakamura <authornari@gmail.com>
* gc.c (assign_heap_slot): SEGV happens cause on 64-bit platform
sometime there should be `objs-=2` instead of `objs--`.
patched by Sokolov Yura. https://github.com/ruby/ruby/pull/92
Tue Feb 14 16:00:30 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
* io.c (io_setstrbuf): cut down the buffer if longer.

4
gc.c
View file

@ -1165,9 +1165,7 @@ assign_heap_slot(rb_objspace_t *objspace)
p = (RVALUE*)((VALUE)p + sizeof(struct heaps_header));
if ((VALUE)p % sizeof(RVALUE) != 0) {
p = (RVALUE*)((VALUE)p + sizeof(RVALUE) - ((VALUE)p % sizeof(RVALUE)));
if ((HEAP_SIZE - HEAP_OBJ_LIMIT * sizeof(RVALUE)) < (size_t)((char*)p - (char*)membase)) {
objs--;
}
objs = (HEAP_SIZE - (size_t)((VALUE)p - (VALUE)membase))/sizeof(RVALUE);
}
lo = 0;