gm2
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gm2] M2LexBuf.mod problem with CurrentTokNo and ListOfTokens.LastBucket


From: Scott Robinson
Subject: [Gm2] M2LexBuf.mod problem with CurrentTokNo and ListOfTokens.LastBucketOffset
Date: Mon, 27 Oct 2008 20:35:56 -0500

Hi Gaius,

I think there is a problem in M2LexBuf.mod with CurrentTokNo and ListOfTokens.LastBucketOffset. These are both declared as CARDINALs and at lines 491 and 493 in procedure GetToken, you are subtracting ListOfTokens.LastBucketOffset from CurrentTokNo implying that CurrentTokNo is supposed to be strictly greater than or equal to ListOfTokens.LastBucketOffset (otherwise you'd get a very large CARDINAL value). At line 811 in procedure AddTokToList, you increment ListOfTokens.LastBucketOffset by MaxBucketSize but don't do anything with CurrentTokNo. This evidently can lead to CurrentTokNo being less than ListOfTokens.LastBucketOffset which, in the scenario I stumbled on, caused GetToken() to recurse enough to segmentation fault due to stack exhaustion.

Let me know if that doesn't make sense and I'll try and explain it better :).

By the way, thanks for the quick fixes on the "preprocessor" problem and the "returning a string constant" problem. Those are both working fine now.

Thanks,
Scott




reply via email to

[Prev in Thread] Current Thread [Next in Thread]