scanf in x64 NASM results in segfault

16 Views Asked by At

I'm trying to make a NASM program which reads two 64-bit integers. My code returns SIGSEGV even before allowing me to input numbers, and I can't figure out why

global main
extern printf, scanf

section .text
main:
  push dword B
  push dword A
  push dword Input_format
  call scanf
  add esp, 12

  xor eax, eax
  ret

section .data
  Input_format: db "%d %d", 0

section .bss
  A: resd 1
  B: resd 1

The code is expected to run successfully without any output, but returns the following: terminated by signal SIGSEGV (Address boundary error)

0

There are 0 best solutions below