[PATCH] fixed SIG_SEGV in check_stack() in eval.c

From: b g <bg_rubyposter_123456@...>
Date: 2004-05-22 00:16:10 UTC
List: ruby-core #2918
I was getting a crash at 'JUMP_TAG(state);' in
check_stack() in eval.c because prot_tag was NULL. 
The JUMP_TAG macro goes right after prot_tag without
checking it to be a valid pointer.  *CRASH*

Attached is my very simple fix.  There's probly a
better way (I don't know why prot_tag is NULL in this
case, should it be?), but the patch below works for
me.

Note, This is version 1.616 of eval.c, which was
apparently shipped with Ruby 1.8.1.  That's the
version I'm running.  I looked at later versions of
eval.c in CVS but didn't see a fix.

I can't provide a test case ;-( because I'm embedding
Ruby inside a commercial product.  The crash occurs
after the app has been running for ~20minutes, with
about 23 million calls on Ruby's rb_funcall() routine.
 (I'm calling a simple method I added to Object by
doing def method_name; ...; end;  That method simply
accesses a few $global variables [Floats], both
reading and writing them.)

-----

rubysrc> diff -p eval-1.616.c
eval-1.616-patch-submit.c  

*** eval-1.616.c                Wed Dec 24 11:38:15
2003
--- eval-1.616-patch-submit.c   Fri May 21 16:35:02
2004
*************** stack_check()
*** 4764,4770 ****
        }
        POP_TAG();
        overflowing = 0;
!       JUMP_TAG(state);
      }
  }
  
--- 4764,4770 ----
        }
        POP_TAG();
        overflowing = 0;
!       if(prot_tag!=NULL) JUMP_TAG(state);
      }
  }



Sincerely,
Brent Geske



	
		
__________________________________
Do you Yahoo!?
Yahoo! Domains Claim yours for only $14.70/year
http://smallbusiness.promotions.yahoo.com/offer 

In This Thread

Prev Next