json 2.9.0 → 2.9.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 583ef6b3c8caf7e7fc9ad5ce6e60b1336ca23438cbd2ed998bea27ffbe8fbf38
4
- data.tar.gz: 4ee0a25a7f0854aa99c0c79f9cdbd4038ac1a00884a840e49d119ab21b229ca1
3
+ metadata.gz: 8404bbc1f96ebfb471ebafc0fadef1f11125cd62c6cf1157091793183a8bdc32
4
+ data.tar.gz: 4c93c85a2575eda3308cf404f116d8e638605d884fb14cd3ab3ee511b649c211
5
5
  SHA512:
6
- metadata.gz: 6ab5ed9d48b51602d00ace1657947c82bf3bb233eb163baa93b582c32c9eb1cc23dec69e88ed94cb26fcabf6dbb7c355f0b67696186345e911beb9736e504aa0
7
- data.tar.gz: 7fb0db017a55c3598004d7e5f640959ff50dc37a7e1ebe9a9e04462ad76f806bd599f7468891b612eaa4648a0c33ca05c3c9183c24489204128f49b2ef149652
6
+ metadata.gz: 2043b99c8ca617249d1b3c81d899ebaf86dc2436196f08b0f9a32ee3ba7fa174c20124ca0f75157828049dc71f46fcd8937978cf463f952b2f2e6af113dfab42
7
+ data.tar.gz: bccae4170d82569a9018ef7497bfb5b228a9371e7c79d84cb4fcc7659be144e3a3ba455db40ecf509a31b576f311d1ad4f85989aea549f59c003210adf87fc77
data/CHANGES.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changes
2
2
 
3
+ ### 2024-12-18 (2.9.1)
4
+
5
+ * Fix support for Solaris 10.
6
+
3
7
  ### 2024-12-03 (2.9.0)
4
8
 
5
9
  * Fix C implementation of `script_safe` escaping to not confuse some other 3 wide characters with `\u2028` and `\u2029`.
@@ -5,6 +5,7 @@ have_func("rb_enc_interned_str", "ruby.h") # RUBY_VERSION >= 3.0
5
5
  have_func("rb_hash_new_capa", "ruby.h") # RUBY_VERSION >= 3.2
6
6
  have_func("rb_hash_bulk_insert", "ruby.h") # Missing on TruffleRuby
7
7
  have_func("rb_category_warn", "ruby.h") # Missing on TruffleRuby
8
+ have_func("strnlen", "string.h") # Missing on Solaris 10
8
9
 
9
10
  append_cflags("-std=c99")
10
11
 
@@ -417,6 +417,14 @@ static char *JSON_parse_number(JSON_Parser *json, char *p, char *pe, VALUE *resu
417
417
  static char *JSON_parse_array(JSON_Parser *json, char *p, char *pe, VALUE *result, int current_nesting);
418
418
 
419
419
 
420
+ #ifndef HAVE_STRNLEN
421
+ static size_t strnlen(const char *s, size_t maxlen)
422
+ {
423
+ char *p;
424
+ return ((p = memchr(s, '\0', maxlen)) ? p - s : maxlen);
425
+ }
426
+ #endif
427
+
420
428
  #define PARSE_ERROR_FRAGMENT_LEN 32
421
429
  #ifdef RBIMPL_ATTR_NORETURN
422
430
  RBIMPL_ATTR_NORETURN()
@@ -439,11 +447,11 @@ static void raise_parse_error(const char *format, const char *start)
439
447
 
440
448
 
441
449
 
442
- #line 465 "parser.rl"
450
+ #line 473 "parser.rl"
443
451
 
444
452
 
445
453
 
446
- #line 447 "parser.c"
454
+ #line 455 "parser.c"
447
455
  enum {JSON_object_start = 1};
448
456
  enum {JSON_object_first_final = 32};
449
457
  enum {JSON_object_error = 0};
@@ -451,7 +459,7 @@ enum {JSON_object_error = 0};
451
459
  enum {JSON_object_en_main = 1};
452
460
 
453
461
 
454
- #line 505 "parser.rl"
462
+ #line 513 "parser.rl"
455
463
 
456
464
 
457
465
  #define PUSH(result) rvalue_stack_push(json->stack, result, &json->stack_handle, &json->stack)
@@ -467,14 +475,14 @@ static char *JSON_parse_object(JSON_Parser *json, char *p, char *pe, VALUE *resu
467
475
  long stack_head = json->stack->head;
468
476
 
469
477
 
470
- #line 471 "parser.c"
478
+ #line 479 "parser.c"
471
479
  {
472
480
  cs = JSON_object_start;
473
481
  }
474
482
 
475
- #line 520 "parser.rl"
483
+ #line 528 "parser.rl"
476
484
 
477
- #line 478 "parser.c"
485
+ #line 486 "parser.c"
478
486
  {
479
487
  short _widec;
480
488
  if ( p == pe )
@@ -503,7 +511,7 @@ case 2:
503
511
  goto st2;
504
512
  goto st0;
505
513
  tr2:
506
- #line 484 "parser.rl"
514
+ #line 492 "parser.rl"
507
515
  {
508
516
  char *np;
509
517
  json->parsing_name = true;
@@ -519,7 +527,7 @@ st3:
519
527
  if ( ++p == pe )
520
528
  goto _test_eof3;
521
529
  case 3:
522
- #line 523 "parser.c"
530
+ #line 531 "parser.c"
523
531
  switch( (*p) ) {
524
532
  case 13: goto st3;
525
533
  case 32: goto st3;
@@ -586,7 +594,7 @@ case 8:
586
594
  goto st8;
587
595
  goto st0;
588
596
  tr11:
589
- #line 473 "parser.rl"
597
+ #line 481 "parser.rl"
590
598
  {
591
599
  char *np = JSON_parse_value(json, p, pe, result, current_nesting);
592
600
  if (np == NULL) {
@@ -600,20 +608,20 @@ st9:
600
608
  if ( ++p == pe )
601
609
  goto _test_eof9;
602
610
  case 9:
603
- #line 604 "parser.c"
611
+ #line 612 "parser.c"
604
612
  _widec = (*p);
605
613
  if ( (*p) < 13 ) {
606
614
  if ( (*p) > 9 ) {
607
615
  if ( 10 <= (*p) && (*p) <= 10 ) {
608
616
  _widec = (short)(128 + ((*p) - -128));
609
617
  if (
610
- #line 482 "parser.rl"
618
+ #line 490 "parser.rl"
611
619
  json->allow_trailing_comma ) _widec += 256;
612
620
  }
613
621
  } else if ( (*p) >= 9 ) {
614
622
  _widec = (short)(128 + ((*p) - -128));
615
623
  if (
616
- #line 482 "parser.rl"
624
+ #line 490 "parser.rl"
617
625
  json->allow_trailing_comma ) _widec += 256;
618
626
  }
619
627
  } else if ( (*p) > 13 ) {
@@ -621,26 +629,26 @@ case 9:
621
629
  if ( 32 <= (*p) && (*p) <= 32 ) {
622
630
  _widec = (short)(128 + ((*p) - -128));
623
631
  if (
624
- #line 482 "parser.rl"
632
+ #line 490 "parser.rl"
625
633
  json->allow_trailing_comma ) _widec += 256;
626
634
  }
627
635
  } else if ( (*p) > 44 ) {
628
636
  if ( 47 <= (*p) && (*p) <= 47 ) {
629
637
  _widec = (short)(128 + ((*p) - -128));
630
638
  if (
631
- #line 482 "parser.rl"
639
+ #line 490 "parser.rl"
632
640
  json->allow_trailing_comma ) _widec += 256;
633
641
  }
634
642
  } else {
635
643
  _widec = (short)(128 + ((*p) - -128));
636
644
  if (
637
- #line 482 "parser.rl"
645
+ #line 490 "parser.rl"
638
646
  json->allow_trailing_comma ) _widec += 256;
639
647
  }
640
648
  } else {
641
649
  _widec = (short)(128 + ((*p) - -128));
642
650
  if (
643
- #line 482 "parser.rl"
651
+ #line 490 "parser.rl"
644
652
  json->allow_trailing_comma ) _widec += 256;
645
653
  }
646
654
  switch( _widec ) {
@@ -661,14 +669,14 @@ case 9:
661
669
  goto st10;
662
670
  goto st0;
663
671
  tr4:
664
- #line 495 "parser.rl"
672
+ #line 503 "parser.rl"
665
673
  { p--; {p++; cs = 32; goto _out;} }
666
674
  goto st32;
667
675
  st32:
668
676
  if ( ++p == pe )
669
677
  goto _test_eof32;
670
678
  case 32:
671
- #line 672 "parser.c"
679
+ #line 680 "parser.c"
672
680
  goto st0;
673
681
  st10:
674
682
  if ( ++p == pe )
@@ -770,13 +778,13 @@ case 20:
770
778
  if ( 47 <= (*p) && (*p) <= 47 ) {
771
779
  _widec = (short)(128 + ((*p) - -128));
772
780
  if (
773
- #line 482 "parser.rl"
781
+ #line 490 "parser.rl"
774
782
  json->allow_trailing_comma ) _widec += 256;
775
783
  }
776
784
  } else if ( (*p) >= 42 ) {
777
785
  _widec = (short)(128 + ((*p) - -128));
778
786
  if (
779
- #line 482 "parser.rl"
787
+ #line 490 "parser.rl"
780
788
  json->allow_trailing_comma ) _widec += 256;
781
789
  }
782
790
  switch( _widec ) {
@@ -795,20 +803,20 @@ case 21:
795
803
  if ( (*p) <= 41 ) {
796
804
  _widec = (short)(128 + ((*p) - -128));
797
805
  if (
798
- #line 482 "parser.rl"
806
+ #line 490 "parser.rl"
799
807
  json->allow_trailing_comma ) _widec += 256;
800
808
  }
801
809
  } else if ( (*p) > 42 ) {
802
810
  if ( 43 <= (*p) )
803
811
  { _widec = (short)(128 + ((*p) - -128));
804
812
  if (
805
- #line 482 "parser.rl"
813
+ #line 490 "parser.rl"
806
814
  json->allow_trailing_comma ) _widec += 256;
807
815
  }
808
816
  } else {
809
817
  _widec = (short)(128 + ((*p) - -128));
810
818
  if (
811
- #line 482 "parser.rl"
819
+ #line 490 "parser.rl"
812
820
  json->allow_trailing_comma ) _widec += 256;
813
821
  }
814
822
  switch( _widec ) {
@@ -831,13 +839,13 @@ case 22:
831
839
  if ( 42 <= (*p) && (*p) <= 42 ) {
832
840
  _widec = (short)(128 + ((*p) - -128));
833
841
  if (
834
- #line 482 "parser.rl"
842
+ #line 490 "parser.rl"
835
843
  json->allow_trailing_comma ) _widec += 256;
836
844
  }
837
845
  } else {
838
846
  _widec = (short)(128 + ((*p) - -128));
839
847
  if (
840
- #line 482 "parser.rl"
848
+ #line 490 "parser.rl"
841
849
  json->allow_trailing_comma ) _widec += 256;
842
850
  }
843
851
  } else if ( (*p) > 46 ) {
@@ -845,19 +853,19 @@ case 22:
845
853
  if ( 48 <= (*p) )
846
854
  { _widec = (short)(128 + ((*p) - -128));
847
855
  if (
848
- #line 482 "parser.rl"
856
+ #line 490 "parser.rl"
849
857
  json->allow_trailing_comma ) _widec += 256;
850
858
  }
851
859
  } else if ( (*p) >= 47 ) {
852
860
  _widec = (short)(128 + ((*p) - -128));
853
861
  if (
854
- #line 482 "parser.rl"
862
+ #line 490 "parser.rl"
855
863
  json->allow_trailing_comma ) _widec += 256;
856
864
  }
857
865
  } else {
858
866
  _widec = (short)(128 + ((*p) - -128));
859
867
  if (
860
- #line 482 "parser.rl"
868
+ #line 490 "parser.rl"
861
869
  json->allow_trailing_comma ) _widec += 256;
862
870
  }
863
871
  switch( _widec ) {
@@ -881,20 +889,20 @@ case 23:
881
889
  if ( (*p) <= 9 ) {
882
890
  _widec = (short)(128 + ((*p) - -128));
883
891
  if (
884
- #line 482 "parser.rl"
892
+ #line 490 "parser.rl"
885
893
  json->allow_trailing_comma ) _widec += 256;
886
894
  }
887
895
  } else if ( (*p) > 10 ) {
888
896
  if ( 11 <= (*p) )
889
897
  { _widec = (short)(128 + ((*p) - -128));
890
898
  if (
891
- #line 482 "parser.rl"
899
+ #line 490 "parser.rl"
892
900
  json->allow_trailing_comma ) _widec += 256;
893
901
  }
894
902
  } else {
895
903
  _widec = (short)(128 + ((*p) - -128));
896
904
  if (
897
- #line 482 "parser.rl"
905
+ #line 490 "parser.rl"
898
906
  json->allow_trailing_comma ) _widec += 256;
899
907
  }
900
908
  switch( _widec ) {
@@ -1008,7 +1016,7 @@ case 31:
1008
1016
  _out: {}
1009
1017
  }
1010
1018
 
1011
- #line 521 "parser.rl"
1019
+ #line 529 "parser.rl"
1012
1020
 
1013
1021
  if (cs >= JSON_object_first_final) {
1014
1022
  long count = json->stack->head - stack_head;
@@ -1059,7 +1067,7 @@ case 31:
1059
1067
  }
1060
1068
 
1061
1069
 
1062
- #line 1063 "parser.c"
1070
+ #line 1071 "parser.c"
1063
1071
  enum {JSON_value_start = 1};
1064
1072
  enum {JSON_value_first_final = 29};
1065
1073
  enum {JSON_value_error = 0};
@@ -1067,7 +1075,7 @@ enum {JSON_value_error = 0};
1067
1075
  enum {JSON_value_en_main = 1};
1068
1076
 
1069
1077
 
1070
- #line 654 "parser.rl"
1078
+ #line 662 "parser.rl"
1071
1079
 
1072
1080
 
1073
1081
  static char *JSON_parse_value(JSON_Parser *json, char *p, char *pe, VALUE *result, int current_nesting)
@@ -1075,14 +1083,14 @@ static char *JSON_parse_value(JSON_Parser *json, char *p, char *pe, VALUE *resul
1075
1083
  int cs = EVIL;
1076
1084
 
1077
1085
 
1078
- #line 1079 "parser.c"
1086
+ #line 1087 "parser.c"
1079
1087
  {
1080
1088
  cs = JSON_value_start;
1081
1089
  }
1082
1090
 
1083
- #line 661 "parser.rl"
1091
+ #line 669 "parser.rl"
1084
1092
 
1085
- #line 1086 "parser.c"
1093
+ #line 1094 "parser.c"
1086
1094
  {
1087
1095
  if ( p == pe )
1088
1096
  goto _test_eof;
@@ -1116,7 +1124,7 @@ st0:
1116
1124
  cs = 0;
1117
1125
  goto _out;
1118
1126
  tr2:
1119
- #line 599 "parser.rl"
1127
+ #line 607 "parser.rl"
1120
1128
  {
1121
1129
  char *np = JSON_parse_string(json, p, pe, result);
1122
1130
  if (np == NULL) {
@@ -1128,7 +1136,7 @@ tr2:
1128
1136
  }
1129
1137
  goto st29;
1130
1138
  tr3:
1131
- #line 609 "parser.rl"
1139
+ #line 617 "parser.rl"
1132
1140
  {
1133
1141
  char *np;
1134
1142
  if(pe > p + 8 && !strncmp(MinusInfinity, p, 9)) {
@@ -1148,7 +1156,7 @@ tr3:
1148
1156
  }
1149
1157
  goto st29;
1150
1158
  tr7:
1151
- #line 627 "parser.rl"
1159
+ #line 635 "parser.rl"
1152
1160
  {
1153
1161
  char *np;
1154
1162
  json->in_array++;
@@ -1158,7 +1166,7 @@ tr7:
1158
1166
  }
1159
1167
  goto st29;
1160
1168
  tr11:
1161
- #line 635 "parser.rl"
1169
+ #line 643 "parser.rl"
1162
1170
  {
1163
1171
  char *np;
1164
1172
  np = JSON_parse_object(json, p, pe, result, current_nesting + 1);
@@ -1166,7 +1174,7 @@ tr11:
1166
1174
  }
1167
1175
  goto st29;
1168
1176
  tr25:
1169
- #line 592 "parser.rl"
1177
+ #line 600 "parser.rl"
1170
1178
  {
1171
1179
  if (json->allow_nan) {
1172
1180
  *result = CInfinity;
@@ -1176,7 +1184,7 @@ tr25:
1176
1184
  }
1177
1185
  goto st29;
1178
1186
  tr27:
1179
- #line 585 "parser.rl"
1187
+ #line 593 "parser.rl"
1180
1188
  {
1181
1189
  if (json->allow_nan) {
1182
1190
  *result = CNaN;
@@ -1186,19 +1194,19 @@ tr27:
1186
1194
  }
1187
1195
  goto st29;
1188
1196
  tr31:
1189
- #line 579 "parser.rl"
1197
+ #line 587 "parser.rl"
1190
1198
  {
1191
1199
  *result = Qfalse;
1192
1200
  }
1193
1201
  goto st29;
1194
1202
  tr34:
1195
- #line 576 "parser.rl"
1203
+ #line 584 "parser.rl"
1196
1204
  {
1197
1205
  *result = Qnil;
1198
1206
  }
1199
1207
  goto st29;
1200
1208
  tr37:
1201
- #line 582 "parser.rl"
1209
+ #line 590 "parser.rl"
1202
1210
  {
1203
1211
  *result = Qtrue;
1204
1212
  }
@@ -1207,9 +1215,9 @@ st29:
1207
1215
  if ( ++p == pe )
1208
1216
  goto _test_eof29;
1209
1217
  case 29:
1210
- #line 641 "parser.rl"
1218
+ #line 649 "parser.rl"
1211
1219
  { p--; {p++; cs = 29; goto _out;} }
1212
- #line 1213 "parser.c"
1220
+ #line 1221 "parser.c"
1213
1221
  switch( (*p) ) {
1214
1222
  case 13: goto st29;
1215
1223
  case 32: goto st29;
@@ -1450,7 +1458,7 @@ case 28:
1450
1458
  _out: {}
1451
1459
  }
1452
1460
 
1453
- #line 662 "parser.rl"
1461
+ #line 670 "parser.rl"
1454
1462
 
1455
1463
  if (json->freeze) {
1456
1464
  OBJ_FREEZE(*result);
@@ -1465,7 +1473,7 @@ case 28:
1465
1473
  }
1466
1474
 
1467
1475
 
1468
- #line 1469 "parser.c"
1476
+ #line 1477 "parser.c"
1469
1477
  enum {JSON_integer_start = 1};
1470
1478
  enum {JSON_integer_first_final = 3};
1471
1479
  enum {JSON_integer_error = 0};
@@ -1473,7 +1481,7 @@ enum {JSON_integer_error = 0};
1473
1481
  enum {JSON_integer_en_main = 1};
1474
1482
 
1475
1483
 
1476
- #line 683 "parser.rl"
1484
+ #line 691 "parser.rl"
1477
1485
 
1478
1486
 
1479
1487
  #define MAX_FAST_INTEGER_SIZE 18
@@ -1513,7 +1521,7 @@ static char *JSON_decode_integer(JSON_Parser *json, char *p, VALUE *result)
1513
1521
  }
1514
1522
 
1515
1523
 
1516
- #line 1517 "parser.c"
1524
+ #line 1525 "parser.c"
1517
1525
  enum {JSON_float_start = 1};
1518
1526
  enum {JSON_float_first_final = 6};
1519
1527
  enum {JSON_float_error = 0};
@@ -1521,7 +1529,7 @@ enum {JSON_float_error = 0};
1521
1529
  enum {JSON_float_en_main = 1};
1522
1530
 
1523
1531
 
1524
- #line 735 "parser.rl"
1532
+ #line 743 "parser.rl"
1525
1533
 
1526
1534
 
1527
1535
  static char *JSON_parse_number(JSON_Parser *json, char *p, char *pe, VALUE *result)
@@ -1530,15 +1538,15 @@ static char *JSON_parse_number(JSON_Parser *json, char *p, char *pe, VALUE *resu
1530
1538
  bool is_float = false;
1531
1539
 
1532
1540
 
1533
- #line 1534 "parser.c"
1541
+ #line 1542 "parser.c"
1534
1542
  {
1535
1543
  cs = JSON_float_start;
1536
1544
  }
1537
1545
 
1538
- #line 743 "parser.rl"
1546
+ #line 751 "parser.rl"
1539
1547
  json->memo = p;
1540
1548
 
1541
- #line 1542 "parser.c"
1549
+ #line 1550 "parser.c"
1542
1550
  {
1543
1551
  if ( p == pe )
1544
1552
  goto _test_eof;
@@ -1578,24 +1586,24 @@ case 6:
1578
1586
  goto st0;
1579
1587
  goto tr7;
1580
1588
  tr7:
1581
- #line 727 "parser.rl"
1589
+ #line 735 "parser.rl"
1582
1590
  { p--; {p++; cs = 7; goto _out;} }
1583
1591
  goto st7;
1584
1592
  st7:
1585
1593
  if ( ++p == pe )
1586
1594
  goto _test_eof7;
1587
1595
  case 7:
1588
- #line 1589 "parser.c"
1596
+ #line 1597 "parser.c"
1589
1597
  goto st0;
1590
1598
  tr8:
1591
- #line 728 "parser.rl"
1599
+ #line 736 "parser.rl"
1592
1600
  { is_float = true; }
1593
1601
  goto st3;
1594
1602
  st3:
1595
1603
  if ( ++p == pe )
1596
1604
  goto _test_eof3;
1597
1605
  case 3:
1598
- #line 1599 "parser.c"
1606
+ #line 1607 "parser.c"
1599
1607
  if ( 48 <= (*p) && (*p) <= 57 )
1600
1608
  goto st8;
1601
1609
  goto st0;
@@ -1614,14 +1622,14 @@ case 8:
1614
1622
  goto st0;
1615
1623
  goto tr7;
1616
1624
  tr9:
1617
- #line 728 "parser.rl"
1625
+ #line 736 "parser.rl"
1618
1626
  { is_float = true; }
1619
1627
  goto st4;
1620
1628
  st4:
1621
1629
  if ( ++p == pe )
1622
1630
  goto _test_eof4;
1623
1631
  case 4:
1624
- #line 1625 "parser.c"
1632
+ #line 1633 "parser.c"
1625
1633
  switch( (*p) ) {
1626
1634
  case 43: goto st5;
1627
1635
  case 45: goto st5;
@@ -1678,7 +1686,7 @@ case 10:
1678
1686
  _out: {}
1679
1687
  }
1680
1688
 
1681
- #line 745 "parser.rl"
1689
+ #line 753 "parser.rl"
1682
1690
 
1683
1691
  if (cs >= JSON_float_first_final) {
1684
1692
  if (!is_float) {
@@ -1734,7 +1742,7 @@ case 10:
1734
1742
 
1735
1743
 
1736
1744
 
1737
- #line 1738 "parser.c"
1745
+ #line 1746 "parser.c"
1738
1746
  enum {JSON_array_start = 1};
1739
1747
  enum {JSON_array_first_final = 22};
1740
1748
  enum {JSON_array_error = 0};
@@ -1742,7 +1750,7 @@ enum {JSON_array_error = 0};
1742
1750
  enum {JSON_array_en_main = 1};
1743
1751
 
1744
1752
 
1745
- #line 825 "parser.rl"
1753
+ #line 833 "parser.rl"
1746
1754
 
1747
1755
 
1748
1756
  static char *JSON_parse_array(JSON_Parser *json, char *p, char *pe, VALUE *result, int current_nesting)
@@ -1755,14 +1763,14 @@ static char *JSON_parse_array(JSON_Parser *json, char *p, char *pe, VALUE *resul
1755
1763
  long stack_head = json->stack->head;
1756
1764
 
1757
1765
 
1758
- #line 1759 "parser.c"
1766
+ #line 1767 "parser.c"
1759
1767
  {
1760
1768
  cs = JSON_array_start;
1761
1769
  }
1762
1770
 
1763
- #line 837 "parser.rl"
1771
+ #line 845 "parser.rl"
1764
1772
 
1765
- #line 1766 "parser.c"
1773
+ #line 1774 "parser.c"
1766
1774
  {
1767
1775
  short _widec;
1768
1776
  if ( p == pe )
@@ -1802,7 +1810,7 @@ case 2:
1802
1810
  goto st2;
1803
1811
  goto st0;
1804
1812
  tr2:
1805
- #line 805 "parser.rl"
1813
+ #line 813 "parser.rl"
1806
1814
  {
1807
1815
  VALUE v = Qnil;
1808
1816
  char *np = JSON_parse_value(json, p, pe, &v, current_nesting);
@@ -1817,12 +1825,12 @@ st3:
1817
1825
  if ( ++p == pe )
1818
1826
  goto _test_eof3;
1819
1827
  case 3:
1820
- #line 1821 "parser.c"
1828
+ #line 1829 "parser.c"
1821
1829
  _widec = (*p);
1822
1830
  if ( 44 <= (*p) && (*p) <= 44 ) {
1823
1831
  _widec = (short)(128 + ((*p) - -128));
1824
1832
  if (
1825
- #line 815 "parser.rl"
1833
+ #line 823 "parser.rl"
1826
1834
  json->allow_trailing_comma ) _widec += 256;
1827
1835
  }
1828
1836
  switch( _widec ) {
@@ -1869,14 +1877,14 @@ case 7:
1869
1877
  goto st3;
1870
1878
  goto st7;
1871
1879
  tr4:
1872
- #line 817 "parser.rl"
1880
+ #line 825 "parser.rl"
1873
1881
  { p--; {p++; cs = 22; goto _out;} }
1874
1882
  goto st22;
1875
1883
  st22:
1876
1884
  if ( ++p == pe )
1877
1885
  goto _test_eof22;
1878
1886
  case 22:
1879
- #line 1880 "parser.c"
1887
+ #line 1888 "parser.c"
1880
1888
  goto st0;
1881
1889
  st8:
1882
1890
  if ( ++p == pe )
@@ -1944,13 +1952,13 @@ case 13:
1944
1952
  if ( 10 <= (*p) && (*p) <= 10 ) {
1945
1953
  _widec = (short)(128 + ((*p) - -128));
1946
1954
  if (
1947
- #line 815 "parser.rl"
1955
+ #line 823 "parser.rl"
1948
1956
  json->allow_trailing_comma ) _widec += 256;
1949
1957
  }
1950
1958
  } else if ( (*p) >= 9 ) {
1951
1959
  _widec = (short)(128 + ((*p) - -128));
1952
1960
  if (
1953
- #line 815 "parser.rl"
1961
+ #line 823 "parser.rl"
1954
1962
  json->allow_trailing_comma ) _widec += 256;
1955
1963
  }
1956
1964
  } else if ( (*p) > 13 ) {
@@ -1958,19 +1966,19 @@ case 13:
1958
1966
  if ( 47 <= (*p) && (*p) <= 47 ) {
1959
1967
  _widec = (short)(128 + ((*p) - -128));
1960
1968
  if (
1961
- #line 815 "parser.rl"
1969
+ #line 823 "parser.rl"
1962
1970
  json->allow_trailing_comma ) _widec += 256;
1963
1971
  }
1964
1972
  } else if ( (*p) >= 32 ) {
1965
1973
  _widec = (short)(128 + ((*p) - -128));
1966
1974
  if (
1967
- #line 815 "parser.rl"
1975
+ #line 823 "parser.rl"
1968
1976
  json->allow_trailing_comma ) _widec += 256;
1969
1977
  }
1970
1978
  } else {
1971
1979
  _widec = (short)(128 + ((*p) - -128));
1972
1980
  if (
1973
- #line 815 "parser.rl"
1981
+ #line 823 "parser.rl"
1974
1982
  json->allow_trailing_comma ) _widec += 256;
1975
1983
  }
1976
1984
  switch( _widec ) {
@@ -2009,13 +2017,13 @@ case 14:
2009
2017
  if ( 47 <= (*p) && (*p) <= 47 ) {
2010
2018
  _widec = (short)(128 + ((*p) - -128));
2011
2019
  if (
2012
- #line 815 "parser.rl"
2020
+ #line 823 "parser.rl"
2013
2021
  json->allow_trailing_comma ) _widec += 256;
2014
2022
  }
2015
2023
  } else if ( (*p) >= 42 ) {
2016
2024
  _widec = (short)(128 + ((*p) - -128));
2017
2025
  if (
2018
- #line 815 "parser.rl"
2026
+ #line 823 "parser.rl"
2019
2027
  json->allow_trailing_comma ) _widec += 256;
2020
2028
  }
2021
2029
  switch( _widec ) {
@@ -2034,20 +2042,20 @@ case 15:
2034
2042
  if ( (*p) <= 41 ) {
2035
2043
  _widec = (short)(128 + ((*p) - -128));
2036
2044
  if (
2037
- #line 815 "parser.rl"
2045
+ #line 823 "parser.rl"
2038
2046
  json->allow_trailing_comma ) _widec += 256;
2039
2047
  }
2040
2048
  } else if ( (*p) > 42 ) {
2041
2049
  if ( 43 <= (*p) )
2042
2050
  { _widec = (short)(128 + ((*p) - -128));
2043
2051
  if (
2044
- #line 815 "parser.rl"
2052
+ #line 823 "parser.rl"
2045
2053
  json->allow_trailing_comma ) _widec += 256;
2046
2054
  }
2047
2055
  } else {
2048
2056
  _widec = (short)(128 + ((*p) - -128));
2049
2057
  if (
2050
- #line 815 "parser.rl"
2058
+ #line 823 "parser.rl"
2051
2059
  json->allow_trailing_comma ) _widec += 256;
2052
2060
  }
2053
2061
  switch( _widec ) {
@@ -2070,13 +2078,13 @@ case 16:
2070
2078
  if ( 42 <= (*p) && (*p) <= 42 ) {
2071
2079
  _widec = (short)(128 + ((*p) - -128));
2072
2080
  if (
2073
- #line 815 "parser.rl"
2081
+ #line 823 "parser.rl"
2074
2082
  json->allow_trailing_comma ) _widec += 256;
2075
2083
  }
2076
2084
  } else {
2077
2085
  _widec = (short)(128 + ((*p) - -128));
2078
2086
  if (
2079
- #line 815 "parser.rl"
2087
+ #line 823 "parser.rl"
2080
2088
  json->allow_trailing_comma ) _widec += 256;
2081
2089
  }
2082
2090
  } else if ( (*p) > 46 ) {
@@ -2084,19 +2092,19 @@ case 16:
2084
2092
  if ( 48 <= (*p) )
2085
2093
  { _widec = (short)(128 + ((*p) - -128));
2086
2094
  if (
2087
- #line 815 "parser.rl"
2095
+ #line 823 "parser.rl"
2088
2096
  json->allow_trailing_comma ) _widec += 256;
2089
2097
  }
2090
2098
  } else if ( (*p) >= 47 ) {
2091
2099
  _widec = (short)(128 + ((*p) - -128));
2092
2100
  if (
2093
- #line 815 "parser.rl"
2101
+ #line 823 "parser.rl"
2094
2102
  json->allow_trailing_comma ) _widec += 256;
2095
2103
  }
2096
2104
  } else {
2097
2105
  _widec = (short)(128 + ((*p) - -128));
2098
2106
  if (
2099
- #line 815 "parser.rl"
2107
+ #line 823 "parser.rl"
2100
2108
  json->allow_trailing_comma ) _widec += 256;
2101
2109
  }
2102
2110
  switch( _widec ) {
@@ -2120,20 +2128,20 @@ case 17:
2120
2128
  if ( (*p) <= 9 ) {
2121
2129
  _widec = (short)(128 + ((*p) - -128));
2122
2130
  if (
2123
- #line 815 "parser.rl"
2131
+ #line 823 "parser.rl"
2124
2132
  json->allow_trailing_comma ) _widec += 256;
2125
2133
  }
2126
2134
  } else if ( (*p) > 10 ) {
2127
2135
  if ( 11 <= (*p) )
2128
2136
  { _widec = (short)(128 + ((*p) - -128));
2129
2137
  if (
2130
- #line 815 "parser.rl"
2138
+ #line 823 "parser.rl"
2131
2139
  json->allow_trailing_comma ) _widec += 256;
2132
2140
  }
2133
2141
  } else {
2134
2142
  _widec = (short)(128 + ((*p) - -128));
2135
2143
  if (
2136
- #line 815 "parser.rl"
2144
+ #line 823 "parser.rl"
2137
2145
  json->allow_trailing_comma ) _widec += 256;
2138
2146
  }
2139
2147
  switch( _widec ) {
@@ -2205,7 +2213,7 @@ case 21:
2205
2213
  _out: {}
2206
2214
  }
2207
2215
 
2208
- #line 838 "parser.rl"
2216
+ #line 846 "parser.rl"
2209
2217
 
2210
2218
  if(cs >= JSON_array_first_final) {
2211
2219
  long count = json->stack->head - stack_head;
@@ -2399,7 +2407,7 @@ static VALUE json_string_unescape(JSON_Parser *json, char *string, char *stringE
2399
2407
  }
2400
2408
 
2401
2409
 
2402
- #line 2403 "parser.c"
2410
+ #line 2411 "parser.c"
2403
2411
  enum {JSON_string_start = 1};
2404
2412
  enum {JSON_string_first_final = 9};
2405
2413
  enum {JSON_string_error = 0};
@@ -2407,7 +2415,7 @@ enum {JSON_string_error = 0};
2407
2415
  enum {JSON_string_en_main = 1};
2408
2416
 
2409
2417
 
2410
- #line 1061 "parser.rl"
2418
+ #line 1069 "parser.rl"
2411
2419
 
2412
2420
 
2413
2421
  static int
@@ -2428,15 +2436,15 @@ static char *JSON_parse_string(JSON_Parser *json, char *p, char *pe, VALUE *resu
2428
2436
  VALUE match_string;
2429
2437
 
2430
2438
 
2431
- #line 2432 "parser.c"
2439
+ #line 2440 "parser.c"
2432
2440
  {
2433
2441
  cs = JSON_string_start;
2434
2442
  }
2435
2443
 
2436
- #line 1081 "parser.rl"
2444
+ #line 1089 "parser.rl"
2437
2445
  json->memo = p;
2438
2446
 
2439
- #line 2440 "parser.c"
2447
+ #line 2448 "parser.c"
2440
2448
  {
2441
2449
  if ( p == pe )
2442
2450
  goto _test_eof;
@@ -2461,14 +2469,14 @@ case 2:
2461
2469
  goto st0;
2462
2470
  goto st2;
2463
2471
  tr2:
2464
- #line 1043 "parser.rl"
2472
+ #line 1051 "parser.rl"
2465
2473
  {
2466
2474
  *result = json_string_fastpath(json, json->memo + 1, p, json->parsing_name, json->parsing_name || json-> freeze, json->parsing_name && json->symbolize_names);
2467
2475
  {p = (( p + 1))-1;}
2468
2476
  p--;
2469
2477
  {p++; cs = 9; goto _out;}
2470
2478
  }
2471
- #line 1036 "parser.rl"
2479
+ #line 1044 "parser.rl"
2472
2480
  {
2473
2481
  *result = json_string_unescape(json, json->memo + 1, p, json->parsing_name, json->parsing_name || json-> freeze, json->parsing_name && json->symbolize_names);
2474
2482
  {p = (( p + 1))-1;}
@@ -2477,7 +2485,7 @@ tr2:
2477
2485
  }
2478
2486
  goto st9;
2479
2487
  tr6:
2480
- #line 1036 "parser.rl"
2488
+ #line 1044 "parser.rl"
2481
2489
  {
2482
2490
  *result = json_string_unescape(json, json->memo + 1, p, json->parsing_name, json->parsing_name || json-> freeze, json->parsing_name && json->symbolize_names);
2483
2491
  {p = (( p + 1))-1;}
@@ -2489,7 +2497,7 @@ st9:
2489
2497
  if ( ++p == pe )
2490
2498
  goto _test_eof9;
2491
2499
  case 9:
2492
- #line 2493 "parser.c"
2500
+ #line 2501 "parser.c"
2493
2501
  goto st0;
2494
2502
  st3:
2495
2503
  if ( ++p == pe )
@@ -2577,7 +2585,7 @@ case 8:
2577
2585
  _out: {}
2578
2586
  }
2579
2587
 
2580
- #line 1083 "parser.rl"
2588
+ #line 1091 "parser.rl"
2581
2589
 
2582
2590
  if (json->create_additions && RTEST(match_string = json->match_string)) {
2583
2591
  VALUE klass;
@@ -2730,7 +2738,7 @@ static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self)
2730
2738
  }
2731
2739
 
2732
2740
 
2733
- #line 2734 "parser.c"
2741
+ #line 2742 "parser.c"
2734
2742
  enum {JSON_start = 1};
2735
2743
  enum {JSON_first_final = 10};
2736
2744
  enum {JSON_error = 0};
@@ -2738,7 +2746,7 @@ enum {JSON_error = 0};
2738
2746
  enum {JSON_en_main = 1};
2739
2747
 
2740
2748
 
2741
- #line 1249 "parser.rl"
2749
+ #line 1257 "parser.rl"
2742
2750
 
2743
2751
 
2744
2752
  /*
@@ -2767,16 +2775,16 @@ static VALUE cParser_parse(VALUE self)
2767
2775
  json->stack = &stack;
2768
2776
 
2769
2777
 
2770
- #line 2771 "parser.c"
2778
+ #line 2779 "parser.c"
2771
2779
  {
2772
2780
  cs = JSON_start;
2773
2781
  }
2774
2782
 
2775
- #line 1277 "parser.rl"
2783
+ #line 1285 "parser.rl"
2776
2784
  p = json->source;
2777
2785
  pe = p + json->len;
2778
2786
 
2779
- #line 2780 "parser.c"
2787
+ #line 2788 "parser.c"
2780
2788
  {
2781
2789
  if ( p == pe )
2782
2790
  goto _test_eof;
@@ -2810,7 +2818,7 @@ st0:
2810
2818
  cs = 0;
2811
2819
  goto _out;
2812
2820
  tr2:
2813
- #line 1241 "parser.rl"
2821
+ #line 1249 "parser.rl"
2814
2822
  {
2815
2823
  char *np = JSON_parse_value(json, p, pe, &result, 0);
2816
2824
  if (np == NULL) { p--; {p++; cs = 10; goto _out;} } else {p = (( np))-1;}
@@ -2820,7 +2828,7 @@ st10:
2820
2828
  if ( ++p == pe )
2821
2829
  goto _test_eof10;
2822
2830
  case 10:
2823
- #line 2824 "parser.c"
2831
+ #line 2832 "parser.c"
2824
2832
  switch( (*p) ) {
2825
2833
  case 13: goto st10;
2826
2834
  case 32: goto st10;
@@ -2909,7 +2917,7 @@ case 9:
2909
2917
  _out: {}
2910
2918
  }
2911
2919
 
2912
- #line 1280 "parser.rl"
2920
+ #line 1288 "parser.rl"
2913
2921
 
2914
2922
  if (json->stack_handle) {
2915
2923
  rvalue_stack_eagerly_release(json->stack_handle);
@@ -2945,16 +2953,16 @@ static VALUE cParser_m_parse(VALUE klass, VALUE source, VALUE opts)
2945
2953
  json->stack = &stack;
2946
2954
 
2947
2955
 
2948
- #line 2949 "parser.c"
2956
+ #line 2957 "parser.c"
2949
2957
  {
2950
2958
  cs = JSON_start;
2951
2959
  }
2952
2960
 
2953
- #line 1315 "parser.rl"
2961
+ #line 1323 "parser.rl"
2954
2962
  p = json->source;
2955
2963
  pe = p + json->len;
2956
2964
 
2957
- #line 2958 "parser.c"
2965
+ #line 2966 "parser.c"
2958
2966
  {
2959
2967
  if ( p == pe )
2960
2968
  goto _test_eof;
@@ -2988,7 +2996,7 @@ st0:
2988
2996
  cs = 0;
2989
2997
  goto _out;
2990
2998
  tr2:
2991
- #line 1241 "parser.rl"
2999
+ #line 1249 "parser.rl"
2992
3000
  {
2993
3001
  char *np = JSON_parse_value(json, p, pe, &result, 0);
2994
3002
  if (np == NULL) { p--; {p++; cs = 10; goto _out;} } else {p = (( np))-1;}
@@ -2998,7 +3006,7 @@ st10:
2998
3006
  if ( ++p == pe )
2999
3007
  goto _test_eof10;
3000
3008
  case 10:
3001
- #line 3002 "parser.c"
3009
+ #line 3010 "parser.c"
3002
3010
  switch( (*p) ) {
3003
3011
  case 13: goto st10;
3004
3012
  case 32: goto st10;
@@ -3087,7 +3095,7 @@ case 9:
3087
3095
  _out: {}
3088
3096
  }
3089
3097
 
3090
- #line 1318 "parser.rl"
3098
+ #line 1326 "parser.rl"
3091
3099
 
3092
3100
  if (json->stack_handle) {
3093
3101
  rvalue_stack_eagerly_release(json->stack_handle);
@@ -415,6 +415,14 @@ static char *JSON_parse_number(JSON_Parser *json, char *p, char *pe, VALUE *resu
415
415
  static char *JSON_parse_array(JSON_Parser *json, char *p, char *pe, VALUE *result, int current_nesting);
416
416
 
417
417
 
418
+ #ifndef HAVE_STRNLEN
419
+ static size_t strnlen(const char *s, size_t maxlen)
420
+ {
421
+ char *p;
422
+ return ((p = memchr(s, '\0', maxlen)) ? p - s : maxlen);
423
+ }
424
+ #endif
425
+
418
426
  #define PARSE_ERROR_FRAGMENT_LEN 32
419
427
  #ifdef RBIMPL_ATTR_NORETURN
420
428
  RBIMPL_ATTR_NORETURN()
data/lib/json/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JSON
4
- VERSION = '2.9.0'
4
+ VERSION = '2.9.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: json
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.9.0
4
+ version: 2.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Frank
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-12-03 00:00:00.000000000 Z
11
+ date: 2024-12-18 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: This is a JSON implementation as a Ruby extension in C.
14
14
  email: flori@ping.de