alive2 icon indicating copy to clipboard operation
alive2 copied to clipboard

Maximum objectsize is smaller than the actual object

Open Forever119 opened this issue 3 weeks ago • 0 comments

For a 16-byte allocation, alive-exec evaluates the maximum object size as 0 instead of a value of at least 16.

Program

declare i64 @llvm.objectsize.i64.p0(ptr, i1 immarg, i1 immarg, i1 immarg)
define i32 @main() {
  %p = alloca [16 x i8]
  %s = call i64 @llvm.objectsize.i64.p0(ptr %p, i1 false, i1 true, i1 false)
  %bad = icmp ult i64 %s, 16
  %r = zext i1 %bad to i32
  ret i32 %r
}

Output

Executing %#0
%p = #b01000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
%s = #x0000000000000000
%bad = #b1
%r = #x00000001
Returned #x00000001 / non-poison=true

Forever119 avatar Nov 09 '26 02:11 Forever119