Add bugfix for ei_decode_big.
"The high order bits of the 16-bits digit (short) are read, even if the byte (at u[(i*2)+1]) doesn't belong to the big. In other words, big numbers such as 16#1234567890 with an odd number of bytes are decoded with a garbage byte (i.e. 16#XX1234567890)." http://erlang.org/pipermail/erlang-bugs/2008-October/001023.html Obtained from: Paul Guyot <pguyot at kallisys.net>
This commit is contained in:
parent
d14a6e684e
commit
90dfafc410
@ -7,7 +7,7 @@
|
||||
|
||||
PORTNAME= erlang
|
||||
PORTVERSION= r13b01
|
||||
PORTREVISION= 3
|
||||
PORTREVISION= 4
|
||||
PORTEPOCH= 1
|
||||
CATEGORIES= lang parallel java
|
||||
MASTER_SITES= http://www.erlang.org/download/ \
|
||||
|
||||
@ -0,0 +1,17 @@
|
||||
|
||||
$FreeBSD$
|
||||
|
||||
--- lib/erl_interface/src/decode/decode_big.c.orig
|
||||
+++ lib/erl_interface/src/decode/decode_big.c
|
||||
@@ -52,7 +52,10 @@
|
||||
u = (unsigned char *) s;
|
||||
for (i = 0; i < b->arity; ++i) {
|
||||
dt[i] = u[i*2];
|
||||
- dt[i] |= ((unsigned short) u[(i*2)+1]) << 8;
|
||||
+ if ((i*2 + 1) < digit_bytes)
|
||||
+ {
|
||||
+ dt[i] |= ((unsigned short) u[(i*2)+1]) << 8;
|
||||
+ }
|
||||
}
|
||||
} else {
|
||||
s++; /* skip sign byte */
|
||||
@ -7,7 +7,7 @@
|
||||
|
||||
PORTNAME= erlang
|
||||
PORTVERSION= r13b01
|
||||
PORTREVISION= 3
|
||||
PORTREVISION= 4
|
||||
PORTEPOCH= 1
|
||||
CATEGORIES= lang parallel java
|
||||
MASTER_SITES= http://www.erlang.org/download/ \
|
||||
|
||||
@ -0,0 +1,17 @@
|
||||
|
||||
$FreeBSD$
|
||||
|
||||
--- lib/erl_interface/src/decode/decode_big.c.orig
|
||||
+++ lib/erl_interface/src/decode/decode_big.c
|
||||
@@ -52,7 +52,10 @@
|
||||
u = (unsigned char *) s;
|
||||
for (i = 0; i < b->arity; ++i) {
|
||||
dt[i] = u[i*2];
|
||||
- dt[i] |= ((unsigned short) u[(i*2)+1]) << 8;
|
||||
+ if ((i*2 + 1) < digit_bytes)
|
||||
+ {
|
||||
+ dt[i] |= ((unsigned short) u[(i*2)+1]) << 8;
|
||||
+ }
|
||||
}
|
||||
} else {
|
||||
s++; /* skip sign byte */
|
||||
Loading…
x
Reference in New Issue
Block a user