Navigation Menu

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

Null pointer access with Fileevent.add_fileoutput #2965

Closed
vicuna opened this issue Sep 19, 2001 · 2 comments
Closed

Null pointer access with Fileevent.add_fileoutput #2965

vicuna opened this issue Sep 19, 2001 · 2 comments
Labels

Comments

@vicuna
Copy link

vicuna commented Sep 19, 2001

Original bug ID: 535
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)

Bug description

Full_Name: Patrick Doane
Version: 3.02
OS: Windows NT 4.0
Submission from: 216.30.40.244 (216.30.40.244)

The following program crashes with an attempt to reference memory at
"0x00000000". If I remove the call to add_fileoutput, then the program does not
crash.

I have installed TCL/TK 8.3 from ftp://ftp.scriptics.com/pub/tcl/tcl8_3/ and
verified that the tcl83.lib and tk83.lib from that installation are the only
ones that exist in the LIB path.

--

open Unix

let fileinput () = prerr_endline "fileinput"
let fileoutput () = prerr_endline "fileoutput"
;;
let test host port =
let inet_addr = (gethostbyname host).h_addr_list.(0) in
let sock_addr = ADDR_INET (inet_addr, port) in
let fd = socket ~domain:PF_INET ~kind:SOCK_STREAM ~protocol:0 in
connect fd sock_addr;
Fileevent.add_fileinput ~fd ~callback:fileinput;
Fileevent.add_fileoutput ~fd ~callback:fileoutput;
;;
let main () =
let top = Tk.openTk () in
test "localhost" 5555;
Tk.mainLoop ()
;;
Unix.handle_unix_error main ()

@vicuna
Copy link
Author

vicuna commented Feb 13, 2002

Comment author: administrator

Fixed by Jacques (2002-02-07)

@vicuna vicuna closed this as completed Feb 13, 2002
@vicuna
Copy link
Author

vicuna commented Feb 13, 2002

Comment author: administrator

The following program crashes with an attempt to reference memory at
"0x00000000". If I remove the call to add_fileoutput, then the
program does not crash.

I'm sorry for the very long delay.
I've now fixed the problem, which was just a stupid asynchrony between
the Unix and Labltk libraries.

Here is a small patch that fixes it, if you can compile ocaml for
windows.
Unfortunately, this doesn't solve the more fundamental problem that
using Tcl channels only works for sockets, and not with pipes... which
I would need for ocamlbrowser.


Jacques Garrigue Kyoto University garrigue at kurims.kyoto-u.ac.jp
JG

Index: cltkFile.c

RCS file: /net/pauillac/caml/repository/csl/otherlibs/labltk/support/cltkFile.c,v
retrieving revision 1.9
retrieving revision 1.11
diff -c -r1.9 -r1.11
*** cltkFile.c 2001/12/07 13:40:09 1.9
--- cltkFile.c 2002/02/07 10:44:37 1.11


*** 106,114 ****

/* Under Win32, we go through the generic channel abstraction */

! /* Map Unix.file_descr values to Tcl channels */

! #define Handle_val(v) (*((HANDLE *)(v)))

static Tcl_Channel tcl_channel(value fd, int flags)
{
--- 106,114 ----

/* Under Win32, we go through the generic channel abstraction */

! #define Handle_val(v) (*((HANDLE *) Data_custom_val(v)))

! /* Map Unix.file_descr values to Tcl channels */

static Tcl_Channel tcl_channel(value fd, int flags)
{

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant