We're updating the issue view to help you get more done. 

need to use icu_malloc() etc.

Description

From: Bob Verbrugge <bobv@nl.compuware.com>
To: Ibm Classes For Unicode/Cupertino/IBM@IBMUS
cc:
Subject: Some ICU remarks

1999-sep-14

Hello,

I noticed following when scanning the some code in common in the
ICU library:

1. Use of malloc instead of icu_malloc in umutex.c
2. Use of realloc instead of icu_realloc in uchar.c and uhash.c
3. Use of free instead of icu_free in filestrm.c
4. Use of memcpy instead of icu_memcpy in putil.c and utypes.h
5. Use of memset instead of icu_memset in putil.c

Seems to me it is more appropriate to use the icu_ versions of
these.

In the converter interface char * and char ** is used
(ucnv_fromUChars, ucnv_toUChars etc) for the legacy character
set streams. It seems better to me to use unsigned char * /
unsigned char ** instead, or probably even better to hide the
native C data types and use uint8_t * / uint8_t ** or a new
type definition for legacy character set streams.

Also i noticed that the substitution character (<subchar> in the
ucm files) is not used for MBCS character sets. Is this done
intentionally?

The library contains some great stuff by the way!

Thanks,
Bob Verbrugge

From: Marvin Mah <mmah@verity.com>
Date: Thu, 19 Aug 1999 13:23:36 -0400
Newsgroups: IBM-Classes-for-Unicode
Subject: NULL pointer access
Message-ID: <ED017B0A0EC317EB005F8B84852567D2.005F8BC0852567D2@alphaworks3>
Path: alphaworks3.alphaworks.ibm.com!news
Lines: 18
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit

Hi

I was debugging an exception and traced it down to the icu classes.

It looks like when ever a call is made to UnicodeString::remove() it
eventually ends up calling UnicodeString::doReplace(UTextOffset, int32_t,
const UChar *, UTextOffset, int32_t) passing in 0 value for const UChar
*srcChars.

This leads to a NULL pointer access in :

us_arrayCopy(srcChars, srcStart, getArrayStart(), start, srcLength);

(us_arrayCopy maps to icu_memmove() which maps to memmove()

Is this a known problem or do I have wrong files?

thanks
Marvin

Status

Assignee

TracBot

Reporter

TracBot

Labels

Reviewer

None

Time Needed

None

Start date

None

Components

Priority

assess