-
Notifications
You must be signed in to change notification settings - Fork 42
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
Possible memory corruption #147
Comments
Great catch! I'll see about fixing this. |
also while running a very simple demo with SBCL v1.3.21, cl-libuv f811e500 and cl-async f5eb6a3: (ql:quickload '(cl-async bordeaux-threads))
(defun tcp-server ()
(as:tcp-server nil 5000
(lambda (sock data)
(as:write-socket-data sock data))
:event-cb (lambda (event)
(format *terminal-io* "event: ~A~%" event)))
(as:signal-handler as:+sigint+
(lambda (sig)
(declare (ignore sig))
(as:exit-event-loop))))
(bt:make-thread #'(lambda ()
(as:start-event-loop #'tcp-server))
:name "cl-async-event-loop-thread")
(defun test ()
(as:start-event-loop
(lambda ()
(as:tcp-connect "127.0.0.1" 5000
(lambda (socket data)
(unless (as:socket-closed-p socket)
(format *terminal-io* "socket-closed~%")
(as:close-socket socket))
(format *terminal-io* "~A" (babel:octets-to-string data)))
:event-cb (lambda (event)
(format *terminal-io* "event: ~A~%" event))
:connect-cb (lambda (socket)
(dotimes (var 4)
(as:write-socket-data socket
(format nil "hello~A" var)))))))) occur memory fault:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In streamish.lisp on line 148 the buffer given to
uv-write
is freed immediately after the function returns. However according to the libuv documention this is not correct as the buffer may only be freed after the callback as been called.So the buffer could be used after the free which will result in memory errors and in the best case in a segfault and worst case possible security issues.
The text was updated successfully, but these errors were encountered: