Skip to Content.
Sympa Menu

svadev - [svadev] memory safety error in d

svadev AT lists.siebelschool.illinois.edu

Subject: Svadev mailing list

List archive

[svadev] memory safety error in d


Chronological Thread 
  • From: Matthew Wala <wala1 AT illinois.edu>
  • To: svadev AT cs.uiuc.edu
  • Subject: [svadev] memory safety error in d
  • Date: Wed, 21 Sep 2011 17:47:24 -0500
  • List-archive: <http://lists.cs.uiuc.edu/pipermail/svadev>
  • List-id: <svadev.cs.uiuc.edu>

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. I don't know if that makes sense though, since it seems
like an issue that should have been caught before.

Matt




Archive powered by MHonArc 2.6.16.

Top of Page