ocaml-mad :: openfile segfault
Hi,
I don't know if you have patched ocaml-mad's openfile function,
in case not: if one provide a wrong filename to this function
we encounter a brutal segfault instead of just an exception.
Here is joined a patch to correct this.
--
Cheers
PS: I've sent it too to the upstream
--- ocaml-mad-0.3.5/src/mad_stubs.c.orig 2009-01-05 00:25:00.000000000 +0100
+++ ocaml-mad-0.3.5/src/mad_stubs.c 2009-08-09 20:27:23.000000000 +0200
@@ -159,6 +159,11 @@
CAMLlocal1(block);
madfile_t *mf;
FILE *fd = fopen(String_val(file), "r");
+ if (fd == NULL) {
+ char err_buf[256];
+ snprintf(err_buf, 256, "Error: couldn't open file \"%s\"", String_val(file));
+ caml_failwith(err_buf);
+ }
/* Remove ID3 tag
* Ref: http://www.id3.org/id3v2.4.0-structure */
Reply to: