Граф коммитов

282 Коммитов

Автор SHA1 Сообщение Дата
Hiroshi SHIBATA eecae51502 [flori/json] Bump up 2.7.1
https://github.com/flori/json/commit/a1af7a308c
2023-12-05 15:09:56 +09:00
Hiroshi SHIBATA a399c1f26d
Removed obsoleted version definition 2023-12-05 12:04:35 +09:00
Hiroshi SHIBATA bf5368493b [flori/json] Detect json version from version.rb
https://github.com/flori/json/commit/3ef57b5b39
2023-12-05 12:04:11 +09:00
Hiroshi SHIBATA abc3d124f7 [flori/json] The modern Ruby uses utf-8 encodings by default
https://github.com/flori/json/commit/11b31210ac
2023-12-05 12:04:10 +09:00
Burdette Lamar c8faaf4c7e [flori/json] [DOC] RDoc for additions
(https://github.com/flori/json/pull/557)

* RDoc for additions

* Update lib/json/add/time.rb

Co-authored-by: Hiroshi SHIBATA <hsbt@ruby-lang.org>

---------

https://github.com/flori/json/commit/3f2efd60f7

Co-authored-by: Hiroshi SHIBATA <hsbt@ruby-lang.org>
2023-12-05 12:04:09 +09:00
tompng 70740deea7 [flori/json] Fix JSON.dump overload combination
https://github.com/flori/json/commit/41c2712a3b
2023-12-05 12:04:08 +09:00
Takashi Kokubun e6b35e8a6d [flori/json] Overload kwargs in JSON.dump
https://github.com/flori/json/commit/936f280f9f
2023-12-05 12:04:08 +09:00
Jean Boussier a22ed89438 [flori/json] JSON.dump: handle unenclosed hashes regression
Fix: https://github.com/flori/json/issues/553

We can never add keyword arguments to `dump` otherwise
existing code using unenclosed hash will break.

https://github.com/flori/json/commit/8e0076a3f2
2023-12-05 12:04:07 +09:00
Hiroshi SHIBATA 86045fca24
Manually merged from flori/json
> https://github.com/flori/json/pull/525
  > Rename escape_slash in script_safe and also escape E+2028 and E+2029

  Co-authored-by: Jean Boussier <jean.boussier@gmail.com>

  > https://github.com/flori/json/pull/454
  > Remove unnecessary initialization of create_id in JSON.parse()

  Co-authored-by: Watson <watson1978@gmail.com>
2023-12-01 16:47:06 +09:00
Jean Boussier 0dfeb17296
Rename escape_slash in script_safe and also escape E+2028 and E+2029
It is rather common to directly interpolate JSON string inside
<script> tags in HTML as to provide configuration or parameters to a
script.

However this may lead to XSS vulnerabilities, to prevent that 3
characters need to be escaped:

  - `/` (forward slash)
  - `U+2028` (LINE SEPARATOR)
  - `U+2029` (PARAGRAPH SEPARATOR)

The forward slash need to be escaped to prevent closing the script
tag early, and the other two are valid JSON but invalid Javascript
and can be used to break JS parsing.

Given that the intent of escaping forward slash is the same than escaping
U+2028 and U+2029, I chos to rename and repurpose the existing `escape_slash`
option.
2023-12-01 16:47:06 +09:00
Jean Boussier 698cb84062
Use ruby_xfree to free buffers
They are allocated with ruby_xmalloc, they should be freed with
ruby_xfree.
2023-12-01 16:47:06 +09:00
Hiroshi SHIBATA 32f289d118
[flori/json] Bump up 2.7.0
https://github.com/flori/json/commit/ca546128f2
2023-12-01 16:47:06 +09:00
John Hawthorn 4b770527c2
[flori/json] Fix "unexpected token" offset for Infinity
Previously in the JSON::Ext parser, when we encountered an "Infinity"
token (and weren't allowing NaN/Infinity) we would try to display the
"unexpected token" at the character before.

https://github.com/flori/json/commit/42ac170712
2023-12-01 16:47:06 +09:00
BurdetteLamar d12e881009
[flori/json] Enhanced RDoc for Range extensions
https://github.com/flori/json/commit/ec47749b53
2023-11-08 09:04:28 +09:00
Nobuyoshi Nakada 19486ebd72 [flori/json] Re-generate parser.c
https://github.com/flori/json/commit/82a75ba98e
2023-07-19 00:02:58 +09:00
Nobuyoshi Nakada 768668a4de [flori/json] Remove unnecessary code
In `JSON#generate` and `JSON#fast_generate`:

- When the given `opts` is a `JSON::State` the variable is set to
  `nil`.
- But it will be never used as the next `if` blocks will not be
  executed.
- `JSON::State#configure` does the conversion to `Hash`, the
  conversions in the `if` block are just duplication.
- `JSON::State.new` does the same thing with `configure` when an
  argument is given.

https://github.com/flori/json/commit/5d9ab87f8e
2023-07-19 00:02:58 +09:00
Nobuyoshi Nakada 104089ce02 [flori/json] [DOC] Remove duplicate sentence
https://github.com/flori/json/commit/ed242667b4
2023-07-19 00:02:58 +09:00
Nobuyoshi Nakada f1f84ca71c [flori/json] Remove `HAVE_RB_SCAN_ARGS_OPTIONAL_HASH` check
This macro is defined since ruby 2.1, which is older than the required
ruby version.

https://github.com/flori/json/commit/dd1d54e78a
2023-07-19 00:02:58 +09:00
Hiroshi SHIBATA 56c8dab468 [flori/json] Skip BigDecimal tests when it's missing to load
https://github.com/flori/json/commit/3dd36c6077
2023-07-18 12:25:55 +09:00
Dimitar Haralanov 9977462fd9 [flori/json] Rename JSON::ParseError to JSON:ParserError
https://github.com/flori/json/commit/20b80ca317
2023-07-18 12:25:54 +09:00
Ufuk Kayserilioglu 12dfd9d1c9
[flori/json] Call `super` in `included` hook
The C extension defines an `included` hook for the
`JSON::Ext::Generator::GeneratorMethods::String` module but neglects to
call `super` in the hook. This can break the functionality of various
other code that rely on the fact that `included` on `Module` will always
be called.

https://github.com/flori/json/commit/cd8bbe56a3
2023-05-24 09:37:30 +09:00
Matt Valentine-House 5e4b80177e Update the depend files 2023-02-28 09:09:00 -08:00
Matt Valentine-House f38c6552f9 Remove intern/gc.h from Make deps 2023-02-27 10:11:56 -08:00
Nobuyoshi Nakada 899ea35035
Extract include/ruby/internal/attr/packed_struct.h
Split `PACKED_STRUCT` and `PACKED_STRUCT_UNALIGNED` macros into the
macros bellow:
* `RBIMPL_ATTR_PACKED_STRUCT_BEGIN`
* `RBIMPL_ATTR_PACKED_STRUCT_END`
* `RBIMPL_ATTR_PACKED_STRUCT_UNALIGNED_BEGIN`
* `RBIMPL_ATTR_PACKED_STRUCT_UNALIGNED_END`
2023-02-08 12:34:13 +09:00
Yusuke Nakamura a22ed3e99d
Fix homepage url in gemspec
GitHub Pages now hosted on *.github.io
2023-01-23 17:06:15 +09:00
Hiroshi SHIBATA 3b45498d3e Merge json-2.6.3 2022-12-09 16:36:22 +09:00
Jean Boussier 66b52f046f [flori/json] Stop including the parser source __LINE__ in exceptions
It makes testing for JSON errors very tedious. You either have
to use a Regexp or to regularly update all your assertions
when JSON is upgraded.

https://github.com/flori/json/commit/de9eb1d28e
2022-07-29 19:10:10 +09:00
Florian Frank 9245b28d34
[flori/json] Bump version to 2.6.2
https://github.com/flori/json/commit/5de358f655
2022-05-20 17:49:13 +09:00
Andrew Bromwich a15d0e267a
[flori/json] Fix parser bug for empty string allocation
When `HAVE_RB_ENC_INTERNED_STR` is enabled it is possible to
pass through a null pointer to `rb_enc_interned_str` resulting
in a segfault

Fixes #495

https://github.com/flori/json/commit/b59368a8c2
2022-05-20 17:49:13 +09:00
Hiroshi SHIBATA 767f3904ee
[flori/json] Doc: Improve documentation on JSON#parse and JSON#parse!
https://github.com/flori/json/commit/75ada77b96

Co-authored-by: Bruno Gomes da Silva <brunojabs@gmail.com>
2022-05-20 17:49:13 +09:00
Peter Zhu 2d5ecd60a5 [Feature #18249] Update dependencies 2022-02-22 09:55:21 -05:00
Nobuyoshi Nakada ac152b3cac
Update dependencies 2021-11-21 16:21:18 +09:00
Hiroshi SHIBATA 1be2875e1d
[flori/json] Bump version to v2.6.1
https://github.com/flori/json/commit/2db5894cfa
2021-10-24 09:25:20 +09:00
Josef Šimánek 4cbce79438
[flori/json] Bump JSON::VERSION to 2.6.0.
https://github.com/flori/json/commit/da94d9f059
2021-10-24 09:25:01 +09:00
Hiroshi SHIBATA 91c2069dcf [flori/json] Bump up json version to 2.6.0
https://github.com/flori/json/commit/1942689b67
2021-10-14 17:04:37 +09:00
卜部昌平 5c167a9778 ruby tool/update-deps --fix 2021-10-05 14:18:23 +09:00
Hiroshi SHIBATA a889ab486e
Update the latest version of json.gemspec from flori/json 2021-07-29 15:57:58 +09:00
Nobuyoshi Nakada 1d170fdc6d
ext/json/parser/parser.h: Add fallback MAYBE_UNUSED
e2ad91fc20
2021-05-19 10:16:22 +09:00
Nobuyoshi Nakada 7c716b686c
ext/json/parser/prereq.mk: fix warnings for code generated by ragel
* type-limits when plain-char is unsigned
* unused-const-variable for NFA constants
2021-05-18 23:26:03 +09:00
Hiroshi SHIBATA ee611341c9
Bump version of required_ruby_version to 2.3. Fixes #464 2021-05-17 19:51:51 +09:00
Jean Boussier 2de594ca98
[flori/json] Deduplicate strings inside json_string_unescape
[ci 2]

https://github.com/flori/json/commit/1982070cb8
2021-05-17 19:51:51 +09:00
Jean Boussier 1d2b4ccaf2
[flori/json] Refactor json_string_unescape
https://github.com/flori/json/commit/f398769332
2021-05-17 19:51:50 +09:00
Masafumi Koba 8a974dc83c [flori/json] Fix incorrect `#` position in API doc
This change fixes an incorrect `#` position in the API documentation of the `JSON` module.

https://github.com/flori/json/commit/dc4b62424f
2021-05-17 19:26:03 +09:00
卜部昌平 6413dc27dc dependency updates 2021-04-13 14:30:21 +09:00
Aaron Patterson 8ef30bcc04
Fix GC compatibility: Don't stash encodings in global constants
This value should either be pinned, or looked up when needed at runtime.
Without pinning, the GC may move the encoding object, and that could
cause a crash.

In this case it is easier to find the value at runtime, and there is no
performance penalty (as Ruby caches encoding indexes).  We can shorten
the code, be compaction friendly, and incur no performance penalty.
2021-02-01 12:20:34 -08:00
Hiroshi SHIBATA 034c19ce28
Merge json-2.5.1 2020-12-22 21:51:15 +09:00
Hiroshi SHIBATA edb76e8765 Prepare to release json-2.5.0 2020-12-22 19:44:27 +09:00
Kenta Murata 0b6a80c0be
[json] Avoid method redefinition 2020-12-21 22:41:24 +09:00
Kenta Murata 14d7d1df25
[json] Make json Ractor safe 2020-12-21 22:10:43 +09:00
Kenta Murata 4c2e7f26bd
[json] JSON_parse_float: Fix how to convert number
Stop BigDecimal-specific optimization.  Instead, it tries the conversion
methods in the following order:

1. `try_convert`,
2. `new`, and
3. class-named function, e.g. `Foo::Bar.Baz` function for `Foo::Bar::Baz` class

If all the above candidates are unavailable, it fallbacks to Float.
2020-12-21 22:10:43 +09:00