[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua 4.0 (alpha), strfind-bug?
- From: Roberto Ierusalimschy <roberto@...>
- Date: Wed, 03 May 2000 14:43:34 -0300
> but there's still one strange thing about my example that I don't understand.
> [...]
> Are there one more bug involved?
I do not think so. Remember that the bug involves a memory violation:
strfind goes after the end of the string looking for the pattern.
Therefore, whether and where it finds the pattern depends on what is
allocated after the string, not on the string itself. Small changes in the
program may change its memory layout, and therefore will change the
results. When you do the convertions from hex to bin and back to hex, you
create new strings with "4E AC" somewhere after the string `s', and this is
what strfind is finding. (In the tests I ran, renaming a local variable
changed the result!)
-- Roberto