I have been receiving semi-frequent U_BUFFER_OVERFLOW_ERROR
I have tracked it down to a tmp buffer being too small. An example case is
below:
NSString *text = @"{{see|Aquila}} <h2>Italian</h2> <h3>Noun</h3>
{{it-noun|aquil|f|a|e}} # [[eagle]] <h4>Derived terms</h4> *[[aquila
arpia]] *[[aquila del Bonelli]] *[[aquila gigante della Nuova Zelanda]]
*[[aquila di Haast]] *[[aquila imperiale]] *[[aquila di mare]] *[[aquila di
mare a coda bianca]] *[[aquila di mare di Steller]] *[[aquila di mare della
testa bianca]] *[[aquila pescatrice africana]] *[[aquila pescatrice del
Madagascar]] *[[aquila reale]] *[[aquila spiegata]] *[[aquila urlatrice]]
<h3>Proper noun</h3> <i>Aquila</i> # See [[L'Aquila]] ---- <h2>Latin</h2>
<h3>Noun</h3> {{la-noun|aquila|aquilae|aquilae|f|first}} # An [[eagle]] #
An eagle as the [[standard]] carried by a [[Roman]] [[legion]].
<h4>Descendants</h4> [[Category:la:Birds]] [[zh-min-nan:aquila]]
[[co:aquila]] [[de:aquila]] [[el:aquila]] [[fr:aquila]] [[gl:aquila]]
[[ko:aquila]] [[hy:aquila]] [[io:aquila]] [[it:aquila]] [[la:aquila]]
[[lt:aquila]] [[hu:aquila]] [[ja:aquila]] [[no:aquila]] [[oc:aquila]]
[[pl:aquila]] [[ru:aquila]] [[fi:aquila]] [[sv:aquila]] [[tr:aquila]]
[[uk:aquila]]";
NSString *regx = @"(\\[{2})(.+?)(]{2})";
NSString *repla = @"<a href=\"$2\">$2</a>";
NSString *matca = [text stringByReplacingOccurrencesOfRegex:regx
withString:repla];
the problem is that the tempUniCharBufferU16Capacity is to small. a few
lines later, there is a check for this, and an increase in the buffer size,
but even then the size isn't enough.
static NSString *rkl_replaceString(RKLCacheSlot *cacheSlot, id
searchString, NSUInteger searchU16Length, NSString *replacementString,
NSUInteger replacementU16Length, NSUInteger *replacedCountPtr, int
replaceMutable, id *exception, int32_t *status) {
int32_t resultU16Length = 0, tempUniCharBufferU16Capacity = 0;
UniChar *tempUniCharBuffer = NULL;
const UniChar *replacementUniChar = NULL;
id resultObject = NULL;
NSUInteger replacedCount = 0;
// Zero order approximation of the buffer sizes for holding the replaced
string or split strings and split strings pointer offsets. As UTF16 code
units.
tempUniCharBufferU16Capacity = (int32_t)(16 + (searchU16Length +
(searchU16Length >> 1)) + (replacementU16Length * 2))];
// Buffer sizes converted from native units to bytes.
size_t stackSize = 0, replacementSize = (replacementU16Length *
sizeof(UniChar)), tempUniCharBufferSize = (tempUniCharBufferU16Capacity *
sizeof(UniChar));
John Engelhart
RegexKitLite
RegexKitLite 2.2
Public
|
Date: 2008-12-10 12:32 I've checked in a fix for this bug. |
| Field | Old Value | Date | By |
|---|---|---|---|
| status_id | Open | 2008-12-10 12:32 | jengelhart |
| resolution_id | None | 2008-12-10 12:32 | jengelhart |
| close_date | - | 2008-12-10 12:32 | jengelhart |
Copyright © 2010 Geeknet, Inc. All rights reserved. Terms of Use