SoftSec-KAIST / MeanDiff

Testing Intermediate Representations for Binary Analysis (ASE '17)
https://softsec-kaist.github.io/MeanDiff/
MIT License
79 stars 11 forks source link

Missing signed extension - `push` #5

Open mfaerevaag opened 7 years ago

mfaerevaag commented 7 years ago

Description

Missing signed extension of immediate value when pushing -0x1.

Reference: Ref. Intel 64 and IA-32 Architecture Software Developer's Manual Vol. 2B 4-509

Affected instructions:

0x6aff

NOTE: All combinations of prefixes are omitted.

Reproduction guide

Instruction:

00000000  6AFF              push byte -0x1

Input:

binsec disasm -decode 6aff

Observed output:

          ⎧ 0: @[(esp₍₃₂₎ - 4₍₃₂₎)]₄ := 255₍₃₂₎
push 0xff ⎨ 1: esp := (esp₍₃₂₎ - 4₍₃₂₎)
          ⎩ 2: goto ({0x00000002; 32}, 0)

Expected output: Added signed extension.

System Info

OS:

# uname -a
Linux ubuntu 4.10.0-28-generic #32-Ubuntu SMP Fri Jun 30 05:32:18 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
# cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=17.04
DISTRIB_CODENAME=zesty
DISTRIB_DESCRIPTION="Ubuntu 17.04"

BINSEC: 20170301 0.1