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

« back to all changes in this revision

Viewing changes to src/test/regress/sql/jsonb.sql

  • 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:
10
10
SELECT '"\u"'::jsonb;                   -- ERROR, incomplete escape
11
11
SELECT '"\u00"'::jsonb;                 -- ERROR, incomplete escape
12
12
SELECT '"\u000g"'::jsonb;               -- ERROR, g is not a hex digit
13
 
SELECT '"\u0000"'::jsonb;               -- OK, legal escape
 
13
SELECT '"\u0045"'::jsonb;               -- OK, legal escape
 
14
SELECT '"\u0000"'::jsonb;               -- ERROR, we don't support U+0000
14
15
-- use octet_length here so we don't get an odd unicode char in the
15
16
-- output
16
17
SELECT octet_length('"\uaBcD"'::jsonb::text); -- OK, uppercase and lower case both OK
156
157
SELECT '{"a":"b", "b":1, "c":null}'::jsonb @> '{"a":"b"}';
157
158
SELECT '{"a":"b", "b":1, "c":null}'::jsonb @> '{"a":"b", "c":"q"}';
158
159
 
 
160
SELECT '[1,2]'::jsonb @> '[1,2,2]'::jsonb;
 
161
SELECT '[1,1,2]'::jsonb @> '[1,2,2]'::jsonb;
 
162
SELECT '[[1,2]]'::jsonb @> '[[1,2,2]]'::jsonb;
 
163
SELECT '[1,2,2]'::jsonb <@ '[1,2]'::jsonb;
 
164
SELECT '[1,2,2]'::jsonb <@ '[1,1,2]'::jsonb;
 
165
SELECT '[[1,2,2]]'::jsonb <@ '[[1,2]]'::jsonb;
 
166
 
159
167
SELECT jsonb_contained('{"a":"b"}', '{"a":"b", "b":1, "c":null}');
160
168
SELECT jsonb_contained('{"a":"b", "c":null}', '{"a":"b", "b":1, "c":null}');
161
169
SELECT jsonb_contained('{"a":"b", "g":null}', '{"a":"b", "b":1, "c":null}');
366
374
SELECT jsonb '{ "a":  "\ude04X" }' -> 'a'; -- orphan low surrogate
367
375
 
368
376
-- handling of simple unicode escapes
369
 
SELECT jsonb '{ "a":  "the Copyright \u00a9 sign" }' ->> 'a' AS correct_in_utf8;
370
 
SELECT jsonb '{ "a":  "dollar \u0024 character" }' ->> 'a' AS correct_everyWHERE;
371
 
SELECT jsonb '{ "a":  "null \u0000 escape" }' ->> 'a' AS not_unescaped;
 
377
 
 
378
SELECT jsonb '{ "a":  "the Copyright \u00a9 sign" }' as correct_in_utf8;
 
379
SELECT jsonb '{ "a":  "dollar \u0024 character" }' as correct_everywhere;
 
380
SELECT jsonb '{ "a":  "dollar \\u0024 character" }' as not_an_escape;
 
381
SELECT jsonb '{ "a":  "null \u0000 escape" }' as fails;
 
382
SELECT jsonb '{ "a":  "null \\u0000 escape" }' as not_an_escape;
 
383
 
 
384
SELECT jsonb '{ "a":  "the Copyright \u00a9 sign" }' ->> 'a' as correct_in_utf8;
 
385
SELECT jsonb '{ "a":  "dollar \u0024 character" }' ->> 'a' as correct_everywhere;
 
386
SELECT jsonb '{ "a":  "dollar \\u0024 character" }' ->> 'a' as not_an_escape;
 
387
SELECT jsonb '{ "a":  "null \u0000 escape" }' ->> 'a' as fails;
 
388
SELECT jsonb '{ "a":  "null \\u0000 escape" }' ->> 'a' as not_an_escape;
372
389
 
373
390
-- jsonb_to_record and jsonb_to_recordset
374
391