1

I am writing a reversing challenge where I need to seed a bug. It's important to have a particular ordering of local variable on stack in a method. However, gcc seems to shuffle those around. How can I control variable ordering in such cases?

  • Did you tried without all optimizations? Is it a overflow challenge? I found this, docs about optimization options. But, i cannot find any option similar to your problem. It has lots of reordering option though maybe one of them or combination of these options may be used for your situation. Another method can be using inline assembly. – de6f Feb 25 '17 at 9:52
  • 2
    I think that wrapping your local variables in a structure should be enough to prevent GCC reordering them. – Ian Cook Feb 25 '17 at 13:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.