On 03/10/11 15:41, Tom Hughes wrote:
> On 03/10/11 15:23, Andrew Cooper wrote:
>
>> Where the two errors are referring to the two strlen() calls when
>> calculating newsize.
>>
>> Are these errors indicating a supposed bug in my code, or are they
>> complaining about something in the __GI_strlen replaced code.  If so,
>> does this mean there is a bug in __GI_strlen ?
> Most likely it means you are calling strlen on something that isn't nul 
> terminated.
>
> Make sure the code at symbol.cpp:9 is nul terminating the string, as 
> that is where the allocation is made that you are running off the end of.
>
> Tom
>

Ah - fantastic catch.  Thankyou.  I had an off by one error when
allocating the original name, which was hidden by a strncpy.

FYI: I am in the process of optimizing a working application for space -
this bug has come about as a result of converting from std::string to
char *.  Profiling appears to show this leading to a 7% memory reduction.

Is there a useful location to put an FAQ/equiv stating that an apparent
error in __GI_strlen might suggest that you are not working with NULL
terminating strings? Google was no use which is why I emailed the list.

-- 
Andrew Cooper - Dom0 Kernel Engineer, Citrix XenServer
T: +44 (0)1223 225 900, http://www.citrix.com


------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
Valgrind-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to