caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: malc <malc@pulsesoft.com>
To: caml-list@inria.fr
Subject: Re: [Caml-list] Cryptokit.Zlib uncompressing fails to terminate (fwd) (Another Patch)
Date: Tue, 16 Nov 2004 13:17:28 +0300 (MSK)	[thread overview]
Message-ID: <Pine.LNX.4.61.0411161315220.7654@home.oyster.ru> (raw)
In-Reply-To: <Pine.LNX.4.55.0411021921150.1095@home.oyster.ru>

Hello,

Previous patch for Cryptokit's Zlib was flawed (it did fix the original
problem while, on the other hand introducing another and much bigger one)

Here is another attempt (also thanks to David MENTRE for noticing a nasty
typo in comments):

diff -ur cryptokit-1.2-orig/cryptokit.ml cryptokit-1.2/cryptokit.ml
--- cryptokit-1.2-orig/cryptokit.ml     Thu Jul 10 17:37:38 2003
+++ cryptokit-1.2/cryptokit.ml  Tue Nov 16 12:35:16 2004
@@ -33,6 +33,7 @@
    | No_entropy_source
    | Entropy_source_closed
    | Compression_not_supported
+  | Input_buffer_to_big

  exception Error of error

@@ -2029,12 +2030,14 @@
      method put_substring src ofs len =
        if len > 0 then begin
          self#ensure_capacity 64;
-        let (_, used_in, used_out) =
+        let (finished, used_in, used_out) =
            inflate zs
                    src ofs len
                    obuf oend (String.length obuf - oend)
                    Z_SYNC_FLUSH in
          oend <- oend + used_out;
+        if finished && not (used_in = len)
+        then raise (Error Input_buffer_to_big);
          if used_in < len
          then self#put_substring src (ofs + used_in) (len - used_in)
        end
diff -ur cryptokit-1.2-orig/cryptokit.mli cryptokit-1.2/cryptokit.mli
--- cryptokit-1.2-orig/cryptokit.mli    Thu Jul 10 17:37:38 2003
+++ cryptokit-1.2/cryptokit.mli Tue Nov 16 13:13:26 2004
@@ -922,6 +922,9 @@
        (** End of file on a device or EGD entropy source. *)
    | Compression_not_supported
        (** The data compression functions are not available. *)
+  | Input_buffer_to_big
+      (** More data has been passed to a function than it can
+          gracefully handle *)

  exception Error of error
    (** Exception raised by functions in this library


-- 
mailto:malc@pulsesoft.com


      reply	other threads:[~2004-11-16 10:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-17  2:53 [Caml-list] Cryptokit.Zlib uncompressing fails to terminate (fwd) malc
2004-10-17 11:10 ` Nicolas Cannasse
2004-11-02 16:22 ` [Caml-list] Cryptokit.Zlib uncompressing fails to terminate (fwd) (Patch) malc
2004-11-16 10:17   ` malc [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.61.0411161315220.7654@home.oyster.ru \
    --to=malc@pulsesoft.com \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).