Skip to Content.
Sympa Menu

svadev - Re: [svadev] memory safety error in d

svadev AT lists.siebelschool.illinois.edu

Subject: Svadev mailing list

List archive

Re: [svadev] memory safety error in d


Chronological Thread 
  • From: John Criswell <criswell AT illinois.edu>
  • To: Matthew Wala <wala1 AT illinois.edu>
  • Cc: svadev AT cs.uiuc.edu
  • Subject: Re: [svadev] memory safety error in d
  • Date: Thu, 22 Sep 2011 09:47:52 -0500
  • List-archive: <http://lists.cs.uiuc.edu/pipermail/svadev>
  • List-id: <svadev.cs.uiuc.edu>
  • Organization: University of Illinois

On 9/21/11 5:47 PM, Matthew Wala wrote:
Hi everyone:

I think I may know why my code was triggering memory safety bugs in
the LLVM test suite program MultiSource/Applications/d. It turns out
that d uses strdup() as an allocator. In
lib/Support/AllocatorInfo.cpp, the
StringAllocatorInfo:getOrCreateAllocSize uses a call to strlen() to
determine the size of the allocation. The problem is that the real
size of strdup(s) is strlen(s) + 1, but the current code just does
strlen(s). So I believe it was registering the item in the pool with
the wrong object size, which is why my checks were giving an off by
one error.

Can you easily verify that, in fact, the pool_register() call is using strlen(s) and not strlen(s) + 1 as the object registration size? If you can verify it, then you know that's the problem, and you can fix it.

-- John T.

I don't know if that makes sense though, since it seems
like an issue that should have been caught before.

Matt
_______________________________________________
svadev mailing list
svadev AT cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/svadev





Archive powered by MHonArc 2.6.16.

Top of Page