git.annexia.org
/
ocaml-bitstring.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
3a856c6
)
Permissive subbitstring allows a segmentation fault (issue #16).
author
Richard W.M. Jones
<rich@annexia.org>
Fri, 30 Mar 2012 12:49:30 +0000
(12:49 +0000)
committer
Richard W.M. Jones
<rich@annexia.org>
Fri, 30 Mar 2012 12:49:30 +0000
(12:49 +0000)
Fix by mrvn.
bitstring.ml
patch
|
blob
|
history
diff --git
a/bitstring.ml
b/bitstring.ml
index
1044d89
..
8a9ef3e
100644
(file)
--- a/
bitstring.ml
+++ b/
bitstring.ml
@@
-130,7
+130,7
@@
let bitstring_length (_, _, len) = len
let subbitstring (data, off, len) off' len' =
let off = off + off' in
- if
len < off' +
len' then invalid_arg "subbitstring";
+ if
off' < 0 || len' < 0 || off' > len -
len' then invalid_arg "subbitstring";
(data, off, len')
let dropbits n (data, off, len) =