forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit25a7812
committed
Fix JSON error reporting for many cases of erroneous string values.
The majority of error exit cases in json_lex_string() failed toset lex->token_terminator, causing problems for the error contextreporting code: it would see token_terminator less than token_startand do something more or less nuts. In v14 and up the end resultcould be as bad as a crash in report_json_context(). Olderversions accidentally avoided that fate; but all versions produceerror context lines that are far less useful than intended,because they'd stop at the end of the prior token instead ofcontinuing to where the actually-bad input is.To fix, invent some macros that make it less notationally painfulto do the right thing. Also add documentation about what thefunction is actually required to do; and in >= v14, add an assertionin report_json_context about token_terminator being sufficientlyfar advanced.Per report from Nikolay Shaplov. Back-patch to all supportedversions.Discussion:https://postgr.es/m/7332649.x5DLKWyVIX@thinkpad-pgpro1 parent30dbdbe commit25a7812
File tree
4 files changed
+78
-59
lines changed- src
- backend/utils/adt
- common
- test/regress/expected
4 files changed
+78
-59
lines changedLines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
675 | 675 |
| |
676 | 676 |
| |
677 | 677 |
| |
| 678 | + | |
678 | 679 |
| |
679 | 680 |
| |
680 | 681 |
| |
|
Lines changed: 47 additions & 29 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
697 | 697 |
| |
698 | 698 |
| |
699 | 699 |
| |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
700 | 708 |
| |
701 | 709 |
| |
702 | 710 |
| |
| |||
705 | 713 |
| |
706 | 714 |
| |
707 | 715 |
| |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
708 | 729 |
| |
709 | 730 |
| |
710 | 731 |
| |
| |||
715 | 736 |
| |
716 | 737 |
| |
717 | 738 |
| |
718 |
| - | |
719 |
| - | |
720 |
| - | |
721 |
| - | |
| 739 | + | |
722 | 740 |
| |
723 | 741 |
| |
724 | 742 |
| |
725 | 743 |
| |
726 | 744 |
| |
727 | 745 |
| |
728 | 746 |
| |
729 |
| - | |
730 |
| - | |
731 |
| - | |
732 |
| - | |
| 747 | + | |
733 | 748 |
| |
734 | 749 |
| |
735 | 750 |
| |
| |||
739 | 754 |
| |
740 | 755 |
| |
741 | 756 |
| |
742 |
| - | |
743 |
| - | |
744 |
| - | |
745 |
| - | |
| 757 | + | |
746 | 758 |
| |
747 | 759 |
| |
748 | 760 |
| |
749 | 761 |
| |
750 | 762 |
| |
751 | 763 |
| |
752 | 764 |
| |
753 |
| - | |
754 |
| - | |
755 |
| - | |
756 |
| - | |
| 765 | + | |
757 | 766 |
| |
758 | 767 |
| |
759 | 768 |
| |
| |||
763 | 772 |
| |
764 | 773 |
| |
765 | 774 |
| |
766 |
| - | |
| 775 | + | |
767 | 776 |
| |
768 | 777 |
| |
769 | 778 |
| |
770 | 779 |
| |
771 | 780 |
| |
772 | 781 |
| |
773 |
| - | |
| 782 | + | |
774 | 783 |
| |
775 | 784 |
| |
776 | 785 |
| |
777 | 786 |
| |
778 | 787 |
| |
779 |
| - | |
| 788 | + | |
780 | 789 |
| |
781 | 790 |
| |
782 | 791 |
| |
| |||
786 | 795 |
| |
787 | 796 |
| |
788 | 797 |
| |
789 |
| - | |
| 798 | + | |
790 | 799 |
| |
791 | 800 |
| |
792 | 801 |
| |
| |||
800 | 809 |
| |
801 | 810 |
| |
802 | 811 |
| |
803 |
| - | |
| 812 | + | |
804 | 813 |
| |
805 | 814 |
| |
806 | 815 |
| |
| |||
820 | 829 |
| |
821 | 830 |
| |
822 | 831 |
| |
823 |
| - | |
| 832 | + | |
824 | 833 |
| |
825 | 834 |
| |
826 | 835 |
| |
827 | 836 |
| |
828 | 837 |
| |
829 | 838 |
| |
830 |
| - | |
| 839 | + | |
831 | 840 |
| |
832 | 841 |
| |
833 | 842 |
| |
| |||
852 | 861 |
| |
853 | 862 |
| |
854 | 863 |
| |
855 |
| - | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
856 | 870 |
| |
857 |
| - | |
858 |
| - | |
| 871 | + | |
859 | 872 |
| |
860 | 873 |
| |
861 | 874 |
| |
| |||
868 | 881 |
| |
869 | 882 |
| |
870 | 883 |
| |
871 |
| - | |
872 |
| - | |
| 884 | + | |
873 | 885 |
| |
874 | 886 |
| |
875 | 887 |
| |
876 | 888 |
| |
877 | 889 |
| |
878 | 890 |
| |
879 | 891 |
| |
880 |
| - | |
| 892 | + | |
881 | 893 |
| |
882 | 894 |
| |
883 | 895 |
| |
| |||
917 | 929 |
| |
918 | 930 |
| |
919 | 931 |
| |
| 932 | + | |
| 933 | + | |
920 | 934 |
| |
| 935 | + | |
921 | 936 |
| |
922 | 937 |
| |
923 | 938 |
| |
924 | 939 |
| |
925 | 940 |
| |
| 941 | + | |
| 942 | + | |
| 943 | + | |
926 | 944 |
| |
927 | 945 |
| |
928 | 946 |
| |
|
Lines changed: 12 additions & 12 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
56 | 56 |
| |
57 | 57 |
| |
58 | 58 |
| |
59 |
| - | |
| 59 | + | |
60 | 60 |
| |
61 | 61 |
| |
62 | 62 |
| |
63 |
| - | |
| 63 | + | |
64 | 64 |
| |
65 | 65 |
| |
66 | 66 |
| |
67 |
| - | |
| 67 | + | |
68 | 68 |
| |
69 | 69 |
| |
70 | 70 |
| |
71 |
| - | |
| 71 | + | |
72 | 72 |
| |
73 | 73 |
| |
74 | 74 |
| |
| |||
121 | 121 |
| |
122 | 122 |
| |
123 | 123 |
| |
124 |
| - | |
| 124 | + | |
125 | 125 |
| |
126 | 126 |
| |
127 | 127 |
| |
| |||
159 | 159 |
| |
160 | 160 |
| |
161 | 161 |
| |
162 |
| - | |
| 162 | + | |
163 | 163 |
| |
164 | 164 |
| |
165 | 165 |
| |
| |||
180 | 180 |
| |
181 | 181 |
| |
182 | 182 |
| |
183 |
| - | |
| 183 | + | |
184 | 184 |
| |
185 | 185 |
| |
186 | 186 |
| |
187 | 187 |
| |
188 | 188 |
| |
189 |
| - | |
| 189 | + | |
190 | 190 |
| |
191 | 191 |
| |
192 | 192 |
| |
193 | 193 |
| |
194 | 194 |
| |
195 |
| - | |
| 195 | + | |
196 | 196 |
| |
197 | 197 |
| |
198 | 198 |
| |
199 | 199 |
| |
200 | 200 |
| |
201 |
| - | |
| 201 | + | |
202 | 202 |
| |
203 | 203 |
| |
204 | 204 |
| |
| |||
223 | 223 |
| |
224 | 224 |
| |
225 | 225 |
| |
226 |
| - | |
| 226 | + | |
227 | 227 |
| |
228 | 228 |
| |
229 | 229 |
| |
| |||
253 | 253 |
| |
254 | 254 |
| |
255 | 255 |
| |
256 |
| - | |
| 256 | + | |
257 | 257 |
| |
258 | 258 |
| |
259 | 259 |
| |
|
0 commit comments
Comments
(0)