Hi, I'm not sure if this is exactly the right place but some linkes on the 
web told me that it was so here goes:

At the neovim project (https://github.com/neovim/neovim) we're refactoring 
the codebase and we've got a few hairy cases:

- we'd like to replace strncpy with strlcpy. strncpy zero-fills the part of 
the buffer after 
- we'd like to replace a growing array that memsets the extra memory to 0 
with one that doesn't

Most call-sites are safe to transform as-is, because the zero-filling 
wasn't used, but some aren't. This could be
because the memory region is used in some other function way up or down the 
call-stack. It's very difficult to
ascertain that a conversion is perfectly safe.

This is where I thought that manually poisoning the memory that used to be 
zero-filled would be a good idea. There
is a snag however: when the poisoned memory is written to before it's read, 
that's fine. Because that counts more or less
as initializing. Yet if the poisoned memory is first read, then it should 
abort.

I searched and found the Address Sanitizer manual poisoning wiki 
page: https://code.google.com/p/address-sanitizer/wiki/ManualPoisoning

But at first glance, it doesn't seem like it could do 
read-until-write-poisoning. Is what I want doable? If not with ASan, 
perhaps with
some other tool or with ASan in the future?

Kind regards,
Nicolas

-- 
You received this message because you are subscribed to the Google Groups 
"address-sanitizer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to