crategus / cl-cffi-gtk

cl-cffi-gtk is a Lisp binding to the GTK+ 3 library.
http://www.crategus.com/books/cl-cffi-gtk
146 stars 33 forks source link

Fix improper null check in class-property-info #56

Open jasom opened 6 years ago

jasom commented 6 years ago

This caused a null-pointer dereference as a race condition in nEXT

stacksmith commented 6 years ago

I think you can skip the null check, and just check for null-pointer. The C function can never return a Lisp NIL object.

(unless (cffi:null-pointer-p param-spec))
  (parse-g-param-spec param-spec))
Ferada commented 6 years ago

@jasom If you change the let* in there to a let only - ... and then make a PR to https://github.com/Ferada/cl-cffi-gtk because I'm maintaining that somewhat - I'd be happy to merge it.

PuercoPop commented 6 years ago

You can't skip the nil check, if one passes nil to null-pointer-p it raises a type error

The value
  NIL
is not of type
  SB-SYS:SYSTEM-AREA-POINTER
when binding CFFI-SYS::PTR
   [Condition of type TYPE-ERROR]

(and g-object-class-find-property returns nil when the property is not found

jasom commented 6 years ago

@Ferada I put a PR in to your fork. I changed the let* but left the nil check in per @PuercoPop's comment

stacksmith commented 6 years ago

@PuercoPop: re null-pointer-p parameter - Thanks, I missed that! You made my life a little bit better!