[Gambas-user] Issue 210 in gambas: For Each corrupts the stack

gambas at ...2524... gambas at ...2524...
Sun Feb 12 20:48:42 CET 2012


Status: New
Owner: ----
Labels: Version Type-Bug Priority-Medium OpSys-Any Dist-Any Arch-Any  
Desktop-Any GUI-Any

New issue 210 by emil.len... at ...626...: For Each corrupts the stack
http://code.google.com/p/gambas/issues/detail?id=210

1) Describe the problem.
When something stops an enumeration, the stack is very likely to get  
corrupted.

2) GIVE THE FOLLOWING INFORMATIONS (if they are appropriate):

Version: TRUNK

3) Provide a little project that reproduces the bug or the crash.
Public Sub Main()
   Dim i As Integer
   Dim j As Integer
   Dim e As New Collection
   For i = 1 To 2
     e["hello"] = 1
     For Each j In e
       e.Clear()
     Next
   Next
End

The interpreter crashes with a segmentation fault because the stack is  
popped when there isn't anything to pop off.

I think it can be fixed by moving
   if (drop || cenum->stop)
     POP();
to the inside of the if-statement above in gbx_exec_enum.c.





More information about the User mailing list