summaryrefslogtreecommitdiffstats
path: root/stdlib
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>2010-03-28 08:16:45 +0000
committerXavier Leroy <xavier.leroy@inria.fr>2010-03-28 08:16:45 +0000
commit8f0185c58df244d4cf42b213771693d2f0f47bdb (patch)
treed438a76673cb6e93eddf57fa3c4f56a69829c51a /stdlib
parent18dc1143304c31428c1ed36d69875c37fd018871 (diff)
PR#5004: overflow in Buffer.add_channel
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@10216 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'stdlib')
-rw-r--r--stdlib/buffer.ml2
1 files changed, 2 insertions, 0 deletions
diff --git a/stdlib/buffer.ml b/stdlib/buffer.ml
index 088840981..9327aaefb 100644
--- a/stdlib/buffer.ml
+++ b/stdlib/buffer.ml
@@ -100,6 +100,8 @@ let add_buffer b bs =
add_substring b bs.buffer 0 bs.position
let add_channel b ic len =
+ if len < 0 || len > Sys.max_string_length then (* PR#5004 *)
+ invalid_arg "Buffer.add_channel";
if b.position + len > b.length then resize b len;
really_input ic b.buffer b.position len;
b.position <- b.position + len