~ubuntu-branches/ubuntu/utopic/postgresql-9.4/utopic-security

« back to all changes in this revision

Viewing changes to src/test/regress/expected/jsonb.out

  • Committer: Package Import Robot
  • Author(s): Martin Pitt, CVE-2014-8161
  • Date: 2015-02-06 12:31:46 UTC
  • mfrom: (1.1.5) (7.1.2 utopic-proposed)
  • Revision ID: package-import@ubuntu.com-20150206123146-vtmf30jbkm7w16p8
Tags: 9.4.1-0ubuntu0.14.10
* New upstream security/bug fix release (LP: #1418928)
  - Fix buffer overruns in to_char() [CVE-2015-0241]
  - Fix buffer overruns in contrib/pgcrypto [CVE-2015-0243]
  - Fix possible loss of frontend/backend protocol synchronization after an
    error [CVE-2015-0244]
  - Fix information leak via constraint-violation error messages
    [CVE-2014-8161]
  - See release notes for details about other fixes:
    http://www.postgresql.org/about/news/1569/

Show diffs side-by-side

added added

removed removed

Lines of Context:
60
60
               ^
61
61
DETAIL:  "\u" must be followed by four hexadecimal digits.
62
62
CONTEXT:  JSON data, line 1: "\u000g...
63
 
SELECT '"\u0000"'::jsonb;               -- OK, legal escape
64
 
  jsonb   
65
 
----------
66
 
 "\u0000"
 
63
SELECT '"\u0045"'::jsonb;               -- OK, legal escape
 
64
 jsonb 
 
65
-------
 
66
 "E"
67
67
(1 row)
68
68
 
 
69
SELECT '"\u0000"'::jsonb;               -- ERROR, we don't support U+0000
 
70
ERROR:  unsupported Unicode escape sequence
 
71
LINE 1: SELECT '"\u0000"'::jsonb;
 
72
               ^
 
73
DETAIL:  \u0000 cannot be converted to text.
 
74
CONTEXT:  JSON data, line 1: ...
69
75
-- use octet_length here so we don't get an odd unicode char in the
70
76
-- output
71
77
SELECT octet_length('"\uaBcD"'::jsonb::text); -- OK, uppercase and lower case both OK
707
713
 f
708
714
(1 row)
709
715
 
 
716
SELECT '[1,2]'::jsonb @> '[1,2,2]'::jsonb;
 
717
 ?column? 
 
718
----------
 
719
 t
 
720
(1 row)
 
721
 
 
722
SELECT '[1,1,2]'::jsonb @> '[1,2,2]'::jsonb;
 
723
 ?column? 
 
724
----------
 
725
 t
 
726
(1 row)
 
727
 
 
728
SELECT '[[1,2]]'::jsonb @> '[[1,2,2]]'::jsonb;
 
729
 ?column? 
 
730
----------
 
731
 t
 
732
(1 row)
 
733
 
 
734
SELECT '[1,2,2]'::jsonb <@ '[1,2]'::jsonb;
 
735
 ?column? 
 
736
----------
 
737
 t
 
738
(1 row)
 
739
 
 
740
SELECT '[1,2,2]'::jsonb <@ '[1,1,2]'::jsonb;
 
741
 ?column? 
 
742
----------
 
743
 t
 
744
(1 row)
 
745
 
 
746
SELECT '[[1,2,2]]'::jsonb <@ '[[1,2]]'::jsonb;
 
747
 ?column? 
 
748
----------
 
749
 t
 
750
(1 row)
 
751
 
710
752
SELECT jsonb_contained('{"a":"b"}', '{"a":"b", "b":1, "c":null}');
711
753
 jsonb_contained 
712
754
-----------------
1762
1804
DETAIL:  Unicode low surrogate must follow a high surrogate.
1763
1805
CONTEXT:  JSON data, line 1: { "a":...
1764
1806
-- handling of simple unicode escapes
1765
 
SELECT jsonb '{ "a":  "the Copyright \u00a9 sign" }' ->> 'a' AS correct_in_utf8;
 
1807
SELECT jsonb '{ "a":  "the Copyright \u00a9 sign" }' as correct_in_utf8;
 
1808
        correct_in_utf8        
 
1809
-------------------------------
 
1810
 {"a": "the Copyright © sign"}
 
1811
(1 row)
 
1812
 
 
1813
SELECT jsonb '{ "a":  "dollar \u0024 character" }' as correct_everywhere;
 
1814
     correct_everywhere      
 
1815
-----------------------------
 
1816
 {"a": "dollar $ character"}
 
1817
(1 row)
 
1818
 
 
1819
SELECT jsonb '{ "a":  "dollar \\u0024 character" }' as not_an_escape;
 
1820
           not_an_escape           
 
1821
-----------------------------------
 
1822
 {"a": "dollar \\u0024 character"}
 
1823
(1 row)
 
1824
 
 
1825
SELECT jsonb '{ "a":  "null \u0000 escape" }' as fails;
 
1826
ERROR:  unsupported Unicode escape sequence
 
1827
LINE 1: SELECT jsonb '{ "a":  "null \u0000 escape" }' as fails;
 
1828
                     ^
 
1829
DETAIL:  \u0000 cannot be converted to text.
 
1830
CONTEXT:  JSON data, line 1: { "a":...
 
1831
SELECT jsonb '{ "a":  "null \\u0000 escape" }' as not_an_escape;
 
1832
        not_an_escape         
 
1833
------------------------------
 
1834
 {"a": "null \\u0000 escape"}
 
1835
(1 row)
 
1836
 
 
1837
SELECT jsonb '{ "a":  "the Copyright \u00a9 sign" }' ->> 'a' as correct_in_utf8;
1766
1838
   correct_in_utf8    
1767
1839
----------------------
1768
1840
 the Copyright © sign
1769
1841
(1 row)
1770
1842
 
1771
 
SELECT jsonb '{ "a":  "dollar \u0024 character" }' ->> 'a' AS correct_everyWHERE;
 
1843
SELECT jsonb '{ "a":  "dollar \u0024 character" }' ->> 'a' as correct_everywhere;
1772
1844
 correct_everywhere 
1773
1845
--------------------
1774
1846
 dollar $ character
1775
1847
(1 row)
1776
1848
 
1777
 
SELECT jsonb '{ "a":  "null \u0000 escape" }' ->> 'a' AS not_unescaped;
1778
 
   not_unescaped    
 
1849
SELECT jsonb '{ "a":  "dollar \\u0024 character" }' ->> 'a' as not_an_escape;
 
1850
      not_an_escape      
 
1851
-------------------------
 
1852
 dollar \u0024 character
 
1853
(1 row)
 
1854
 
 
1855
SELECT jsonb '{ "a":  "null \u0000 escape" }' ->> 'a' as fails;
 
1856
ERROR:  unsupported Unicode escape sequence
 
1857
LINE 1: SELECT jsonb '{ "a":  "null \u0000 escape" }' ->> 'a' as fai...
 
1858
                     ^
 
1859
DETAIL:  \u0000 cannot be converted to text.
 
1860
CONTEXT:  JSON data, line 1: { "a":...
 
1861
SELECT jsonb '{ "a":  "null \\u0000 escape" }' ->> 'a' as not_an_escape;
 
1862
   not_an_escape    
1779
1863
--------------------
1780
1864
 null \u0000 escape
1781
1865
(1 row)