Encoding.c should use ruby_strdup

e$B1sF#$G$9!#e(B

encoding.c [email protected]$Ne(B strdup
e$B$r;H$C$F$$$FJV$jCM$N8!::$r$7$F$$$J$$e(B
e$B$?$a!"e(Bfailmalloc e$B$G$$$8$a$k$HMn$A$^$9!#e(B

$ FAILMALLOC_SPACE=0x10 \

LD_PRELOAD=/home/mame/local/lib/libfailmalloc.so
./ruby
Segmentation fault

encoding.c e$B$Ge(B #include “ruby/util.h” e$B$7$F!"e(Bruby_strdup
e$B$r;H$o$;$ke(B
e$B$h$&$K$9$k$HD>$j$^$9!#H?BP$,$J$1$l$P%3%_%C%H$7$?$$$H;W$$$^$9!#e(B

Index: encoding.c

— encoding.c (revision 18307)
+++ encoding.c (working copy)
@@ -16,6 +16,7 @@
#ifdef HAVE_LANGINFO_H
#include <langinfo.h>
#endif
+#include “ruby/util.h”

static ID id_encoding, id_base_encoding;
VALUE rb_cEncoding;
Index: common.mk

— common.mk (revision 18307)
+++ common.mk (working copy)
@@ -451,7 +451,7 @@
dmyencoding.$(OBJEXT): {$(VPATH)}dmyencoding.c
{$(VPATH)}encoding.c $(RUBY_H_INCLUDES) {$(VPATH)}st.h
{$(VPATH)}encoding.h {$(VPATH)}oniguruma.h {$(VPATH)}regenc.h
-encoding.$(OBJEXT): dmyencoding.$(OBJEXT)
+encoding.$(OBJEXT): dmyencoding.$(OBJEXT) {$(VPATH)}util.h
enum.$(OBJEXT): {$(VPATH)}enum.c $(RUBY_H_INCLUDES)
{$(VPATH)}st.h {$(VPATH)}node.h {$(VPATH)}util.h
enumerator.$(OBJEXT): {$(VPATH)}enumerator.c $(RUBY_H_INCLUDES) \

e$B$"$H!";v8e$K$J$j$^$9$,!"e(Bvm.c [email protected]$Ne(B malloc
e$B$r;H$C$F%A%’%C%/e(B
e$B$9$k$h$&$K$7$^$7$?e(B (r18306) e$B!#$^$?!"e(Bgc.c e$B$NCf$Ge(B
rb_memerror() e$B$re(B
e$B8F$VA0$Ke(B during_gc = 0; e$B$9$k$h$&$K$7$^$7$?e(B (r18307) e$B!#e(B

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs