views:

86

answers:

1

I'm using the wonderful RegexKitLite framework built upon the ICU library that ships with Mac OS X and iPhone OS. It has been smooth sailing so far, with the exception of this error that appears intermittently when searching for matches:

Internal Error
Invalid parameter not satisfying:
(cacheSlot->setToHash == buffer->hash) && (cacheSlot->setToLength == buffer->length) && (cacheSlot->setToUniChar == buffer->uniChar)

Any idea what might be causing this?

A: 

NOTE: I'm the author of RegexKitLite.

This is an internal assertion failure within RegexKitLite. There are a lot of built-in internal assertion checks. This one is saying that after retrieving a cached compiled regex from the cache, the retrieved cached regex is not set up exactly as it should be for some reason.

The best thing you can do is submit a bug report at sourceforge.net RegexKit bug tracker. If at all possible, submit a test case that reproduces the bug. This is a total, wild, out of the blue guess, but based on the assertion message, I'd bet that it has something to do with match operations in which you are using the range: parameter, and that range is constantly 'moving" and shrinking. That range may cross the small/large buffer size, somewhere around 2048 characters. Another possibility is searching strings that contain Unicode characters and RegexKitLite is using the strings direct buffer, possibly on a mutable string and the backing buffer has be reallocated because it grew or shrank... or, a mutable string that was "non-Unicode" has been mutated and now contains Unicode characters, and it has switch from the cached UTF-16 conversion to the strings direct buffer.

Hopefully, that will help you narrow down the corner case that is triggering the assertion failure. Hey, at least it's detecting a problem instead of plodding along and seg faulting or returning bogus result strings. :)

johne