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

u_austrcpy / UnicodeString::extract assume things about the memory layout

Description

The following functions call ucnv_fromUnicode() or ucnv_toUnicode() with
pointers of the form "x 0xFFFFFF" where x is some pointer:

u_austrcpy() u_uastrcpy() UnicodeString::extract()

What happens is that these convenience functions (using the default transcoder)
want to assume an unlimited target buffer. So, they set targetLimit to (target
MAX_STRLEN) i nthe case of u_austrcpy. This wraps around on some platforms!

Fix: Change ucnv_fromUChars(), ucnv_toUChars(), and UnicodeString::extract()
to:

  • calculate a targetLimit with target MAX_STRLEN

  • if (targetLimit < target)
    targetLimit = U_MAX_PTR;

where U_MAX_PTR is defined to something like ((void*)-1) in utypes.h

This bug prevents the ICU from working on Solaris 2.7.

Status

Assignee

TracBot

Reporter

TracBot

Labels

Reviewer

None

Time Needed

None

Start date

None

Components

Priority

assess