giraph-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexander O. Anisimov" <alenyas...@gmail.com>
Subject May be bug in UnsafeByteArrayOutputStream
Date Thu, 24 Oct 2013 03:15:44 GMT
Hi,

I think I have found bug code in
org.apache.giraph.utils.UnsafeByteArrayOutputStream.

Let's see method *writeChars(String s)*

public void writeChars(String s) throws IOException {
>     // Note that this code is mostly copied from DataOutputStream
>     int len = s.length();
>     ensureSize(len);
>     for (int i = 0; i < len; i++) {
>       int v = s.charAt(i);
>       buf[pos++] = (byte) ((v >>> 8) & 0xFF);
>       buf[pos++] = (byte) ((v >>> 0) & 0xFF);
>     }
> }
>

The method *ensureSize* is called with an argument *len*, although in
*buf*added
*2 * len* bytes.

Am i right?


.''`.  With best regards,
: :' : Alexander Anisimov
`. `'  JID alenyashka@gmail.com
  `-   Debian - when you have better things to do than fixing systems

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message