Giter Site home page Giter Site logo

Potential null dereference. According to coding standards in 'Creating and Returning NSError Objects' the parameter 'error' may be null. about facebook-ios-sdk HOT 6 CLOSED

leddo avatar leddo commented on April 25, 2024
Potential null dereference. According to coding standards in 'Creating and Returning NSError Objects' the parameter 'error' may be null.

from facebook-ios-sdk.

Comments (6)

yujuan avatar yujuan commented on April 25, 2024

In Objective-C a method can only return one value, and this is a typical case where you want to return two. In C-like languages when you need to return an extra value you ask for a pointer to a value of that type. The NSError** pattern is used when a method returns some value but may also want to return an error object (of type NSError*). see ref http://stackoverflow.com/questions/903103/why-does-nserror-need-double-indirection-pointer-to-a-pointer.
So you can ignore these warning

from facebook-ios-sdk.

jameseanthony avatar jameseanthony commented on April 25, 2024

Hi yujuan,

leddo is actually correct that this is a problem in the FBRequest code. The NSError *_'s should be checked against NULL, otherwise calling *error = ... may cause a null dereference and crash. *error = {...} calls should be replaced with if(error != NULL) {_error = {...}}

from facebook-ios-sdk.

yujuan avatar yujuan commented on April 25, 2024

The only place that call this function is id result = [self parseJsonResponse:data error:&error]; in the same file which essentially warranty that error is not null from the caller side.

from facebook-ios-sdk.

jameseanthony avatar jameseanthony commented on April 25, 2024

It doesn't cause a crash now, but it causes warnings and isn't robust against future modifications.

from facebook-ios-sdk.

yujuan avatar yujuan commented on April 25, 2024

ok, that is good point, I will make this change in the next revision.

from facebook-ios-sdk.

yujuan avatar yujuan commented on April 25, 2024

just check in the fix

from facebook-ios-sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.