2
0
mirror of https://github.com/boostorg/json.git synced 2026-01-19 04:12:14 +00:00
Commit Graph

14 Commits

Author SHA1 Message Date
Dmitry Arkhipov
bacc644f93 deprecate type aliases 2024-02-09 13:19:49 +03:00
Dmitry Arkhipov
3d751ad9e5 handle bias overflow 2023-06-28 13:22:49 +03:00
Dmitry Arkhipov
be759c5051 only throw system_error 2023-06-02 16:23:08 +03:00
Dmitry Arkhipov
51d86cdd12 option to allow Infinity and NaN literals 2023-06-02 11:53:40 +03:00
Dmitry Arkhipov
9b06d4a410 fix suspend inside escape 2023-03-25 16:24:47 +03:00
Dmitry Arkhipov
36552f0c94 remove namespace macros 2023-01-02 18:41:01 +03:00
Max Kellermann
0f987f07d7 basic_parser: make sentinel() return a unique pointer
Right now, sentinel() casts the `basic_parser` pointer (`this`) to
`const char *`, but that pointer is not unique if the input buffer
happens to be placed right before the `basic_parser_impl` instance -
the end of that buffer then has the same address as `basic_parser`.

Example code:

```
  struct {
    char buffer[8]{"{\"12345\""};
    boost::json::stream_parser p;
  } s;
  s.p.write(s.buffer, sizeof(s.buffer));
  s.p.write(":0}", 3);
```

This stops parsing at the end of the buffer, and then the
`incomplete()` check in `parse_string()` will return true; the second
`write()` call will crash with assertion failure:

> boost/json/basic_parser_impl.hpp:1016: const char* boost::json::basic_parser<Handler>::parse_unescaped(const char*, std::integral_constant<bool, StackEmpty_>, std::integral_constant<bool, AllowComments_>, bool) [with bool StackEmpty_ = true; bool IsKey_ = true; Handler = boost::json::detail::handler]: Assertion `*cs == '\x22'' failed.

This changes `sentinel()` by adding 1 to guaranteed that the sentinel
pointer is unique even if the input buffers borders on this object.
2022-12-30 15:18:00 +01:00
Dmitry Arkhipov
56eaebf1cb add source_location to error_codes 2022-02-18 14:31:47 +03:00
Dmitry Arkhipov
1523954c98 Add std::error_code overloads 2022-02-06 17:35:09 +03:00
Dmitry Arkhipov
445efad9a9 Remove trailing whitespace 2021-06-26 16:17:57 +03:00
Vinnie Falco
94d11a74e6 Refactor storage_ptr (API Change) 2020-10-04 19:07:58 -07:00
Vinnie Falco
9b86962fbc Add metadata and update repo links 2020-10-04 11:06:25 -07:00
Vinnie Falco
08dd10b5f5 stream_parser docs, test, and tidy 2020-09-27 20:26:57 -07:00
Vinnie Falco
d026d5daed Rename to stream_parser 2020-09-26 17:57:00 -07:00