Skip to content

Commit

Permalink
Add missing check on PyUnicode_AsUTF8AndSize() possible error
Browse files Browse the repository at this point in the history
  • Loading branch information
lelit committed Jan 7, 2018
1 parent 54c716c commit f5fc756
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion rapidjson.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,12 @@ class PyReadStreamWrapper {
len = PyBytes_GET_SIZE(chunk);
buffer = PyBytes_AS_STRING(chunk);
}
else
else {
buffer = PyUnicode_AsUTF8AndSize(chunk, &len);
if (buffer == NULL) {
len = 0;
}
}

if (len == 0) {
eof = true;
Expand Down

0 comments on commit f5fc756

Please sign in to comment.