From 3c1d5d95d8706f225148c3d9fae060a470bac469 Mon Sep 17 00:00:00 2001 From: olgeni Date: Sat, 13 Jun 2009 10:02:42 +0000 Subject: 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 --- lang/erlang/Makefile | 2 +- .../patch-lib_erl__interface_src_decode_decode__big.c | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 lang/erlang/files/patch-lib_erl__interface_src_decode_decode__big.c (limited to 'lang/erlang') diff --git a/lang/erlang/Makefile b/lang/erlang/Makefile index ef61b99bcfa0..0f0287f76df8 100644 --- a/lang/erlang/Makefile +++ b/lang/erlang/Makefile @@ -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/ \ diff --git a/lang/erlang/files/patch-lib_erl__interface_src_decode_decode__big.c b/lang/erlang/files/patch-lib_erl__interface_src_decode_decode__big.c new file mode 100644 index 000000000000..dd3632543b23 --- /dev/null +++ b/lang/erlang/files/patch-lib_erl__interface_src_decode_decode__big.c @@ -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 */ -- cgit