Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src: no abort from GetFD if object isn't wrapped #6184

Merged
merged 5 commits into from
May 24, 2016

Commits on May 24, 2016

  1. src: inherit first from AsyncWrap

    To make sure casting a class of multiple inheritance from a void* to
    AsyncWrap succeeds make AsyncWrap the first inherited class.
    
    PR-URL: nodejs#6184
    Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
    Reviewed-By: Anna Henningsen <anna@addaleax.net>
    trevnorris committed May 24, 2016
    Configuration menu
    Copy the full SHA
    ddc19be View commit details
    Browse the repository at this point in the history
  2. src: always clear wrap before persistent Reset()

    In case the handle is stored and accessed after the associated C++ class
    was destructed, set the internal pointer to nullptr so any
    getters/setters can return accordingly without aborting the application.
    
    PR-URL: nodejs#6184
    Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
    Reviewed-By: Anna Henningsen <anna@addaleax.net>
    trevnorris committed May 24, 2016
    Configuration menu
    Copy the full SHA
    9dd5b93 View commit details
    Browse the repository at this point in the history
  3. tls_wrap: do not abort on new TLSWrap()

    Though the TLSWrap constructor is only called via TLSWrap::Wrap() (i.e.
    tls_wrap.wrap()) internally, it is still exposed to JS. Don't allow the
    application to abort by inspecting the instance before it has been
    wrap'd by another handle.
    
    PR-URL: nodejs#6184
    Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
    Reviewed-By: Anna Henningsen <anna@addaleax.net>
    trevnorris committed May 24, 2016
    Configuration menu
    Copy the full SHA
    43b5215 View commit details
    Browse the repository at this point in the history
  4. stream_base: always use Base template class

    First cast the pointer to the child Base class before casting to the
    parent class to make sure it returns the correct pointer.
    
    PR-URL: nodejs#6184
    Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
    Reviewed-By: Anna Henningsen <anna@addaleax.net>
    trevnorris committed May 24, 2016
    Configuration menu
    Copy the full SHA
    13e5d4f View commit details
    Browse the repository at this point in the history
  5. src: no abort from getter if object isn't wrapped

    v8::Object::GetAlignedPointerFromInternalField() returns a random value
    if Wrap() hasn't been run on the object handle. Causing v8 to abort if
    certain getters are accessed. It's possible to access these getters and
    functions during class construction through the AsyncWrap init()
    callback, and also possible in a subset of those scenarios while running
    the persistent handle visitor.
    
    Mitigate this issue by manually setting the internal aligned pointer
    field to nullptr in the BaseObject constructor and add necessary logic
    to return appropriate values when nullptr is encountered.
    
    PR-URL: nodejs#6184
    Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
    Reviewed-By: Anna Henningsen <anna@addaleax.net>
    trevnorris committed May 24, 2016
    Configuration menu
    Copy the full SHA
    c0e6c66 View commit details
    Browse the repository at this point in the history