Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Bugfix: Negative ints in HTTP's on_body and node.fs.read()

Similar to the error fixed in
9d3ed1b.

Reported by Felix Geisendörfer.
  • Loading branch information...
commit ed8c43d2f3d20dec77a1206cfe80b8dfb5db5811 1 parent 75fc215
@ry ry authored
Showing with 3 additions and 2 deletions.
  1. +2 −1  src/file.cc
  2. +1 −1  src/http.cc
View
3  src/file.cc
@@ -285,7 +285,8 @@ AfterRawRead(eio_req *req)
size_t len = req->result;
Local<Array> array = Array::New(len);
for (unsigned int i = 0; i < len; i++) {
- array->Set(Integer::New(i), Integer::New(buf[i]));
+ unsigned char val = reinterpret_cast<const unsigned char*>(buf)[i];
+ array->Set(Integer::New(i), Integer::New(val));
}
argv[0] = array;
argv[1] = Integer::New(req->result);
View
2  src/http.cc
@@ -196,7 +196,7 @@ HTTPConnection::on_body (http_parser *parser, const char *buf, size_t len)
// raw encoding
Local<Array> array = Array::New(len);
for (size_t i = 0; i < len; i++) {
- char val = static_cast<const char*>(buf)[i];
+ unsigned char val = reinterpret_cast<const unsigned char*>(buf)[i];
array->Set(Integer::New(i), Integer::New(val));
}
argv[0] = array;
Please sign in to comment.
Something went wrong with that request. Please try again.