Skip to content

Crash with bad memory access using command #6

@coov

Description

@coov

Hi,

I am using ObjCHiredis in a Mac objective C program to access a database hosted on a website.
If the connection to the site goes down, the following call fails with an null memory access:

rand_key = [mRedisDB command:@"RANDOMKEY"];

Looking at the header, I don't see a checkConnection type of function. And if the connection fails, this call definitely doesn't fail gracefully. The header shows the following options:

  • (id)redis:(NSString_)ipaddress on:(NSNumber_)portnumber db:(NSNumber*)db;
  • (id)redis:(NSString_)ipaddress on:(NSNumber_)portnumber;
  • (id)redis;
  • (BOOL)connect:(NSString_)ipaddress on:(NSNumber_)portnumber;
  • (id)command:(NSString*)command;
  • (id)commandArgv:(NSArray*)cargv;
  • (NSArray*)getReply;
  • (BOOL)timesOut;
  • (void)close;

Is there anything that I am missing to avoid making this call without an internet connection? Although I am checking for the connection in my program before making the call, it still will fail if the connection goes down between the check and the above call.

Thanks,

Coov

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions