Vector35 / Vector35/binaryninja-api

printf style variadic functions wrong argument order when vector registers used

Open
#6,203 4 comments 0 reactions 1 assignee View on GitHub

@D0ntPanic is already working on this.

Since Dec 3, 2024.

Component: Core Core: Calling Convention Effort: Low Impact: Low
Dominant language
C++
Stars
1.3k
Forks
298
Avg merge
5d 5h
Merged PRs (30d)
19

Description

Version and Platform (required):

  • Binary Ninja Version: 4.2.6455
  • OS: macOS
  • OS Version:
  • CPU Architecture: x86_64, but likely others

Bug Description:

Decompiling the following code:

#include <stdio.h>

main(){

    printf("%d %d %g %g %g %g %d %d",12,12,0.12,0.13,0.14,0.15,10,9);

}


Results in:
Screenshot 2024-11-26 at 4 19 06 PM

zmm0 through zmm3 shouldn't be at the end.

This might require special casing handling of float values in printf...

Steps To Reproduce:
Please provide all steps required to reproduce the behavior:
Compile sample code, drop binary into Binary Ninja, observe slightly wrong decompilation..

Expected Behavior:

Format string args should match the order specified in the format string itself.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.