Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8438373
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T07:41:48+00:00 2026-06-10T07:41:48+00:00

Background: I’m reversing an Obj-C instance method belonging to a certain class. Here is

  • 0

Background: I’m reversing an Obj-C instance method belonging to a certain class. Here is the interface of the class

@interface myClass : NSObject
    { 
            // aStructure contains a lot of function pointers

         struct aStructure **_myStruct;     // ivar offset: 0x14  
         int                             _integer;             // ivar offset: 0x20
    }

   - (void)aMethod;

@end

Problem:

Here is a snippet of aMethod disassembly

[0x0]      mov   edi,    [ebp+arg_0]     ## put self into edi
[0x2]      mov   edx,   [edi+20h]        ## put  self._integer into edi
[0x3]      cmp   edx,   1
[0x4]      jl       end_of_method       ## if (self._integer < 1) return;
[0x5]      lea     eax,   [edx-0Ch]       ## put &self._myStruct into eax
[0x6]      cmp   eax,   3
[0x7]      ja      end_of_method       ## if (&self._myStruct > 3) return;
// other stuff

The 6th line shows a comparaison between a memory address (&self._myStruct) with 3.

Question: why would you compare a memory address with an int ? It doesn’t make much sense for me, since a memory address will be always > 3, and thus the method will always exit in this case.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T07:41:50+00:00Added an answer on June 10, 2026 at 7:41 am

    lea eax, [edx-0Ch] simply means eax = edx - 12. That the instruction is called “load effective address” doesn’t mean it’s the only thing it can be used for – compilers often output lea instead of add/sub/mul when that instruction is the shorter/faster way of doing a calculation.

    The whole snippet checks if _integer is between 1 and 15. It stores _integer - 12 in eax, presumably because it will be used later in the method.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Background - Normally with basic UIViewControllers I'm across how you can create instance variables
Background From the valuable advice I received here I have now moved all of
Background: What I need to accomplish is to remove any records in a collection
Background: We're building an application that allows our customers to supply data in a
Background: I'm using the (fantastic) Vim plugin python-mode , which includes the pep8 linter.
Background - I am using paramiko to put files on a bunch of remote
Background : I'm trying to convert some JavaScript code which uses the the Crossfilter
Background: I would like to dismiss a modalView that I have presented earlier and
Background I am working with a monad built of a stack of transformers one
Background: I was invited to an interview at a high profile company and I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.