ObjFW  Check-in [41bfdb858c]

Overview
Comment:OFMutableString_UTF8: Add missing range check.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 41bfdb858caf536f3a3885e28f99662661afde2d3263e49babb93e1bf7c7e557
User & Date: js on 2012-10-13 20:35:16
Other Links: manifest | tags
Context
2012-10-13
20:50
Move UTF-8 functions to OFString_UTF8.m. check-in: 9cfefe9c30 user: js tags: trunk
20:35
OFMutableString_UTF8: Add missing range check. check-in: 41bfdb858c user: js tags: trunk
20:02
indexOfFirstOccurrenceOfString -> rangeOfString. check-in: 5209390938 user: js tags: trunk
Changes

Modified src/OFMutableString_UTF8.m from [5e44e80986] to [e0a807cffb].

205
206
207
208
209
210
211



212
213
214
215
216
217
218
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221







+
+
+







	of_unichar_t c;
	size_t length, oldLength;

	if (s->UTF8)
		index = of_string_index_to_position(s->cString, index,
		    s->cStringLength);

	if (index > s->cStringLength)
		@throw [OFOutOfRangeException exceptionWithClass: [self class]];

	if (!(character & 0x80) && !(s->cString[index] & 0x80)) {
		s->hashed = NO;
		s->cString[index] = character;
		return;
	}

	if ((length = of_string_unicode_to_utf8(character, buffer)) == 0)