[webkit-dev] Problem with StringImpl methods (characters() and length())

Seweryn Pływaczyk s.plywaczyk at gmail.com
Thu Aug 27 11:56:23 PDT 2009


I have a strange problem with the mentioned methods and I'd like to ask if
someone of you had a similar one.

During initialization of AtomicString CStringTranslator::equal(StringImpl*
r, const char* s) is called.

There are the following lines inside of this method :

int length = r->length();
const UChar* d = r->characters();

It looks simple but the problem is that length() doesn't return a m_length
but a m_data value which is a pointer to characters and characters() returns
something bad and that's why d is a BadPtr. Because length is non zero value
rest of code is executed and I have an exception here:

if (d[i] != c)

It is really strange because according to code everything should be OK.

I've also debugged this fragment and what I've seen is also strange becuase
values of m_length and m_data are correct.

Maybe it will be simpler if I try give you an example what exactly happens:

Information from debugger:

r address(for example) 0x2cab40
m_length address(for example) 0x2cab44 value 0x0c
m_data address(for example) 0x2cab48 value "abort"

values after call

int length = r->length();
const UChar* d = r->characters();


length = 0x2cab48 - value of m_data !?
d = <BadPtr>

I suppose that I built something in wrong way (under WinCE) but I have
really no idea where I should start an investigation.

If someone of you have any ideas please let me know.

BR, Seweryn
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20090827/87ca2a4f/attachment.html>

More information about the webkit-dev mailing list