Giter Club home page Giter Club logo

ocaml-usb's People

Contributors

fxfactorial avatar glondu avatar jeremiedimino avatar jgjl avatar letoh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

ocaml-usb's Issues

Segfault in a very simple program

The following pretty simple program segfaults

let main () =
  try_lwt
    (* open some non-existent device *)
    let _ = USB.open_device_with 0x04b4 0x1002 in
    Lwt_io.eprintl "Successful"
  with Failure descr -> Lwt_io.eprintl descr

let () = Lwt_main.run (main ())

... and gdb

Program terminated with signal 11, Segmentation fault.
#0  0x00007f54b7f37f57 in libusb_get_next_timeout () from /lib/libusb-1.0.so.0
(gdb) bt
#0  0x00007f54b7f37f57 in libusb_get_next_timeout () from /lib/libusb-1.0.so.0
#1  0x0000000000480438 in ml_usb_get_next_timeout ()
#2  0x00000000004324ac in camlUSB__enter_iter_1134 () at src/USB.ml:201
#3  0x000000000045272d in camlLwt_sequence__loop_1066 ()
    at src/core/lwt_sequence.ml:149
#4  0x00000000004384c3 in camlLwt_main__run_1012 () at src/unix/lwt_main.ml:39
#5  0x0000000000461998 in camlPervasives__fun_1466 () at pervasives.ml:449
#6  0x00000000004313b1 in camlStd_exit__entry () at std_exit.ml:16
#7  0x000000000042e229 in caml_program ()
#8  0x00000000004a5892 in caml_start_program ()
#9  0x00000000004a5a35 in __libc_csu_init ()
#10 0x00007f54b754dc8d in __libc_start_main (main=<value optimized out>, 
    argc=<value optimized out>, ubp_av=<value optimized out>, 
    init=<value optimized out>, fini=<value optimized out>, 
    rtld_fini=<value optimized out>, stack_end=0x7fff9467fb58)
    at libc-start.c:228
#11 0x000000000042dea9 in _start ()

It is interesting, that the same program, but with printf's substituted with Lwt_log primitives works fine.

The system under test is Debian 6.0.6 with libusb 1.0.8-2 and latest OCaml, installed from opam.

To easily reproduce the bug, you can save the provided code to a file "crash.ml" and compile the following command

$ echo "<*.*>: package(lwt.unix),package(lwt.syntax),package(usb),syntax(camlp4o)" > _tags && ocamlbuild -use-ocamlfind crash.native --

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.