[LLVMdev] LLVM Help on input sanitization

Ando Roy wisporaiden at gmail.com
Sun Nov 30 18:46:42 PST 2014


Hello,

I'm new to LLVM, and am experimenting with the viability of the use of
function passes for the sanitization of content in c strings.

This is an excerpt from the IR of some code which performs a strcpy on
between two char arrays buf1 and buf2.

if.else:                                          ; preds = %entry
  %1 = load i8** %buf1, align 8
  %2 = load i8** %buf2, align 8
  %call2 = call i8* @strcpy(i8* %1, i8* %2) #3
  br label %if.end

I would like to know if there is some way to retrieve:
1. The sizes of buffers buf1 and buf2
2. The actual strings in buf1 and buf2

I've tried performing a dyn_cast on the first 2 assignments to LoadInst,
and then printing out the output of the function getOperand(0) on the
LoadInst variable. However, all that I'm seeing are assignment instructions
in the form of:

%buf1 = alloca i8*, align 8
%buf2 = alloca i8*, align 8

Do hope that I can receive some advice. Thanks in advance!

Roy A.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20141130/9a5c9b31/attachment.html>


More information about the llvm-dev mailing list