[Pkg-ocaml-maint-commits] [SCM] ocaml-ssl packaging branch, master, updated. debian/0.4.2-3-7-g497116e

Stephane Glondu steph at glondu.net
Mon Sep 29 17:49:23 UTC 2008


The following commit has been merged in the master branch:
commit 96dfa652b2007158f43569801233a5cede8b77e8
Author: Stephane Glondu <steph at glondu.net>
Date:   Mon Sep 29 19:24:28 2008 +0200

    Fix GC-unsafe operations in C stubs (Closes: #500591)
    
     * caml_{enter,leave}_blocking_section must not be called during GC
     * Store_field must not be called on custom blocks

diff --git a/debian/changelog b/debian/changelog
index 4edeef3..040b680 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -8,8 +8,9 @@ ocaml-ssl (0.4.2-4) UNRELEASED; urgency=low
 
   [ Stephane Glondu ]
   * Switching packaging to git
+  * Fix GC-unsafe operations in C stubs (Closes: #500591)
 
- -- Stephane Glondu <steph at glondu.net>  Mon, 29 Sep 2008 17:17:01 +0200
+ -- Stephane Glondu <steph at glondu.net>  Mon, 29 Sep 2008 19:22:41 +0200
 
 ocaml-ssl (0.4.2-3) unstable; urgency=low
 
diff --git a/src/ssl_stubs.c b/src/ssl_stubs.c
index 3905499..df90bf9 100644
--- a/src/ssl_stubs.c
+++ b/src/ssl_stubs.c
@@ -61,9 +61,7 @@ static int client_verify_callback(int, X509_STORE_CTX *);
 static void finalize_ctx(value block)
 {
   SSL_CTX *ctx = Ctx_val(block);
-  caml_enter_blocking_section();
   SSL_CTX_free(ctx);
-  caml_leave_blocking_section();
 }
 
 static struct custom_operations ctx_ops =
@@ -83,9 +81,7 @@ static struct custom_operations ctx_ops =
 static void finalize_ssl_socket(value block)
 {
   SSL *ssl = SSL_val(block);
-  caml_enter_blocking_section();
   SSL_free(ssl);
-  caml_leave_blocking_section();
 }
 
 static struct custom_operations socket_ops =
@@ -509,9 +505,7 @@ CAMLprim value ocaml_ssl_get_cipher_version(value vcipher)
 static void finalize_cert(value block)
 {
   X509 *cert = Cert_val(block);
-  caml_enter_blocking_section();
   X509_free(cert);
-  caml_leave_blocking_section();
 }
 
 static struct custom_operations cert_ops =
@@ -563,7 +557,7 @@ CAMLprim value ocaml_ssl_get_certificate(value socket)
 
   CAMLlocal1(block);
   block = caml_alloc_final(2, finalize_cert, 0, 1);
-  Store_field(block, 1, (value)cert);
+  (*((X509 **) Data_custom_val(block))) = cert;
   CAMLreturn(block);
 }
 

-- 
ocaml-ssl packaging



More information about the Pkg-ocaml-maint-commits mailing list