forked from bitcoin/bitcoin
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't require nul-terminated string inputs
Avoid giving '\0' characters special treatment in JSON parsing code. This way the parser will reject input strings like "[1,2,3]\0-extra-nonsense" instead of returning a partially parsed interpretation of the input. It also allows the parser to be called with char pointers that might not be nul terminated (like the char pointers returned by std::string::data()). Fixes following test failures in https://github.com/nst/JSONTestSuite: bitcoin SHOULD_HAVE_FAILED n_multidigit_number_then_00.json
- Loading branch information
Showing
8 changed files
with
48 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
unitester | ||
no_nul | ||
|
||
*.trs | ||
*.log |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#include "univalue.h" | ||
|
||
int main (int argc, char *argv[]) | ||
{ | ||
char buf[] = "___[1,2,3]___"; | ||
UniValue val; | ||
return val.read(buf + 3, 7) ? 0 : 1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters