Re: bug report: crm114 'eval' throws error depending on *value* being 'eval'-ed (demo script included)
Bill Yerazunis <[email protected]>
| Newsgroups | gmane.mail.spam.crm114 |
|---|---|
| Message-ID | <[email protected]> |
Date: Mon, 6 Oct 2008 23:43:15 +0200 Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="m51xatjYGsM+13rf" Content-Disposition: inline From: Paolo <[email protected]> --m51xatjYGsM+13rf Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Sat, Oct 04, 2008 at 02:48:10AM +0200, Ger Hobbelt wrote: > Ladies & Gentlemen, > > eval b0rks on empty value: run this demo script to see what I mean: > yep. Attached diff seems to do the trick. FWIF it passes megatest. The important stuff is just the test 'if (itercount == 1)', but I've augumented the trace part, and long -> int isn't important here. The actual cause is much simpler. "ahash" is ormally initialized to all zeroes. The problem is that strnhash returns 0 for a string of length zero as well, so the code as written fails on the first iteration. The fix? Simple. (around crm_expr_alter line 92): initialize ahash[i] to -1 instead. Unlike 0, it's quite difficult to achieve strnhash output of -1. - Bill Yerazunis ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/