X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=tests%2Fdata%2Fsys-file-reader.at;h=d071f37c09f97529d20934181e9635ee2f271010;hb=0ec7c606844768cfc501d6213ffa17ebdfda1bab;hp=e9b262e86425d8a23ce7fd5629b5516b6d2d208c;hpb=649c202d57d7d5d8bb87be5b72839cd56ca4ca0b;p=pspp diff --git a/tests/data/sys-file-reader.at b/tests/data/sys-file-reader.at index e9b262e864..d071f37c09 100644 --- a/tests/data/sys-file-reader.at +++ b/tests/data/sys-file-reader.at @@ -1,3 +1,19 @@ +dnl PSPP - a program for statistical analysis. +dnl Copyright (C) 2017 Free Software Foundation, Inc. +dnl +dnl This program is free software: you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation, either version 3 of the License, or +dnl (at your option) any later version. +dnl +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with this program. If not, see . +dnl AT_BANNER([system file reader - positive]) AT_SETUP([variable labels and missing values]) @@ -568,6 +584,53 @@ num1 done AT_CLEANUP +AT_SETUP([empty document record]) +AT_KEYWORDS([sack synthetic system file positive]) +AT_DATA([sys-file.sack], [dnl +dnl File header. +"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file"; +2; dnl Layout code +1; dnl Nominal case size +0; dnl Not compressed +0; dnl Not weighted +1; dnl 1 case. +100.0; dnl Bias. +"01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file"; +i8 0 *3; + +dnl Numeric variable, no label or missing values. +2; 0; 0; 0; 0x050800 *2; s8 "NUM1"; + +dnl Machine integer info record. +7; 3; 4; 8; 1; 2; 3; -1; 1; 1; ENDIAN; 1252; + +dnl Document record. +6; 0; + +dnl Character encoding record. +7; 20; 1; 12; "windows-1252"; + +dnl Dictionary termination record. +999; 0; + +dnl Data. +1.0; +]) +for variant in be le; do + AT_CHECK([sack --$variant sys-file.sack > sys-file.sav]) + AT_DATA([sys-file.sps], [dnl +GET FILE='sys-file.sav'. +LIST. +]) + AT_CHECK([pspp -o pspp.csv sys-file.sps]) + AT_CHECK([cat pspp.csv], [0], [dnl +Table: Data List +num1 +1 +]) +done +AT_CLEANUP + AT_SETUP([multiple response sets]) AT_KEYWORDS([sack synthetic system file positive]) AT_DATA([sys-file.sack], [dnl @@ -1096,7 +1159,7 @@ AT_DATA([sys-file.sack], [dnl dnl File header. "$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file"; 2; dnl Layout code -2; dnl Nominal case size +3; dnl Nominal case size 0; dnl Not compressed 0; dnl Not weighted 0; dnl 1 case. @@ -1107,6 +1170,7 @@ i8 0 *3; dnl Variables. 2; 0; 0; 0; 0x050800 *2; s8 "FIRSTVAR"; 2; 0; 0; 0; 0x050800 *2; s8 "SECONDVA"; +2; 0; 0; 0; 0x050800 *2; s8 "THIRDVAR"; dnl Machine integer info record. 7; 3; 4; 8; 1; 2; 3; -1; 1; 1; ENDIAN; 1252; @@ -1115,6 +1179,7 @@ dnl Long variable names. 7; 13; 1; COUNT ( "FIRSTVAR=FirstVariable"; i8 9; "SECONDVA=S"; i8 233; "condVariable"; i8 9; +"THIRDVAR=ThirdVariable"; i8 9 ); dnl Data file attributes record. @@ -1133,6 +1198,10 @@ dnl Variable attributes record. "xyzzy('quux'"; i8 10; ")"; ); +dnl Another variable attributes record. +dnl Only system files written by "Stata 14.1/-savespss- 1.77 by S.Radyakin" +dnl include multiple variable attributes records. +7; 18; 1; COUNT ("ThirdVariable:fizz('buzz'"; i8 10; ")";); dnl Character encoding record. 7; 20; 1; 12; "windows-1252"; @@ -1156,6 +1225,8 @@ adèle[2],34 bert,123" SécondVariable,"Attribute,Value xyzzy,quux" +ThirdVariable,"Attribute,Value +fizz,buzz" Table: Custom data file attributes. Attribute,Value @@ -1183,6 +1254,11 @@ Role: Input Attribute,Value xyzzy,quux",2 +ThirdVariable,"Format: F8.0 +Role: Input + +Attribute,Value +fizz,buzz",3 Table: Custom data file attributes. Attribute,Value @@ -1557,6 +1633,43 @@ AT_CLEANUP AT_BANNER([system file reader - negative]) +AT_SETUP([no variables]) +AT_KEYWORDS([sack synthetic system file negative]) +AT_DATA([sys-file.sack], [dnl +dnl File header. +"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file"; +2; dnl Layout code +0; dnl Nominal case size (empty) +0; dnl Not compressed +0; dnl Not weighted +0; dnl 0 cases. +100.0; dnl Bias. +"01 Jan 11"; "20:53:52"; s64 "PSPP synthetic test file"; +i8 0 *3; + +dnl Character encoding record. +7; 20; 1; 12; "windows-1252"; + +dnl Dictionary termination record. +999; 0; +]) +for variant in be le; do + AT_CHECK([sack --$variant sys-file.sack > sys-file.sav]) + AT_DATA([sys-file.sps], [dnl +GET FILE='sys-file.sav'. +]) + AT_CHECK([pspp -O format=csv sys-file.sps], [1], [dnl +sys-file.sps:1: error: GET: `sys-file.sav': Data file dictionary has no variables. +]) + + dnl At one point pspp-convert would hang forever if there were no variables, + dnl so check against regression. + AT_CHECK([pspp-convert sys-file.sav sys-file.txt]) + AT_CHECK([cat sys-file.txt], [0], [ +]) +done +AT_CLEANUP + AT_SETUP([unspecified character encoding]) AT_KEYWORDS([sack synthetic system file positive]) AT_DATA([sys-file.sack], [dnl @@ -2147,36 +2260,6 @@ done AT_CLEANUP -AT_SETUP([empty document record]) -AT_KEYWORDS([sack synthetic system file negative]) -AT_DATA([sys-file.sack], [dnl -dnl File header. -"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file"; -2; 2; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3; - -dnl Numeric variable, no label or missing values. -2; 0; 0; 0; 0x050800 *2; s8 "NUM1"; - -dnl Empty document record. -6; >>0<<; - -dnl Dictionary termination record. -999; 0; - -dnl Data. -1.0; -]) -for variant in be le; do - AT_CHECK([sack --$variant sys-file.sack > sys-file.sav]) - AT_DATA([sys-file.sps], [dnl -GET FILE='sys-file.sav'. -]) - AT_CHECK([pspp -O format=csv sys-file.sps], [1], [dnl -error: `sys-file.sav' near offset 0xd4: Number of document lines (0) must be greater than 0 and less than 26843545. -]) -done -AT_CLEANUP - AT_SETUP([extension record too large]) AT_KEYWORDS([sack synthetic system file negative]) AT_DATA([sys-file.sack], [dnl @@ -2225,8 +2308,8 @@ for variant in be le; do AT_DATA([sys-file.sps], [dnl GET FILE='sys-file.sav'. ]) - AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl -"warning: `sys-file.sav' near offset 0xd8: Unrecognized record type 7, subtype 30. Please send a copy of this file, and the syntax which created it to bug-gnu-pspp@gnu.org." + AT_CHECK_UNQUOTED([pspp -O format=csv sys-file.sps], [0], [dnl +"warning: \`sys-file.sav' near offset 0xd8: Unrecognized record type 7, subtype 30. For help, please send this file to ${PACKAGE_BUGREPORT} and mention that you were using ${PACKAGE_STRING}." ]) done AT_CLEANUP @@ -2456,9 +2539,9 @@ for variant in be le; do MRSETS /DISPLAY NAME=ALL. ]) AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl -warning: `sys-file.sav': Multiple response set name `b' does not begin with `$'. +warning: `sys-file.sav': Invalid multiple response set name `b'. -warning: `sys-file.sav': Multiple response set name `e' does not begin with `$'. +warning: `sys-file.sav': Invalid multiple response set name `e'. Table: Multiple Response Sets Name,Variables,Details @@ -3027,6 +3110,8 @@ dnl Numeric variables. dnl Long variable names. 7; 13; 1; COUNT ( "LONGVARI=_Invalid"; i8 9; +"LONGVARI=$Invalid"; i8 9; +"LONGVARI=#Invalid"; i8 9; "LONGVA_A=LongVariableName"; i8 9; "LONGVA_B=LONGVARIABLENAME"; i8 9; ); @@ -3045,6 +3130,10 @@ GET FILE='sys-file.sav'. AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl warning: `sys-file.sav' near offset 0x138: Long variable mapping from LONGVARI to invalid variable name `_Invalid'. +warning: `sys-file.sav' near offset 0x138: Long variable mapping from LONGVARI to invalid variable name `$Invalid'. + +warning: `sys-file.sav' near offset 0x138: Long variable mapping from LONGVARI to invalid variable name `#Invalid'. + warning: `sys-file.sav' near offset 0x138: Duplicate long variable name `LONGVARIABLENAME'. ]) done @@ -3376,6 +3465,48 @@ warning: `sys-file.sav' near offset 0x106: Attribute value fred[[1]] is not quot done AT_CLEANUP +AT_SETUP([duplicate attribute name]) +AT_KEYWORDS([sack synthetic system file negative]) +AT_DATA([sys-file.sack], [dnl +dnl File header. +"$FL2"; s60 "$(#) SPSS DATA FILE PSPP synthetic test file"; +2; 1; 1; 0; -1; 100.0; "01 Jan 11"; "20:53:52"; s64 ""; i8 0 *3; + +dnl Variables. +2; 0; 0; 0; 0x050800 *2; s8 "FIRSTVAR"; + +dnl Data file attributes record. +7; 17; 1; COUNT ( +"Attr1('value'"; i8 10; ")"; +"Attr1('value'"; i8 10; ")"; +); + +dnl Variable attributes record. +7; 18; 1; COUNT ( +"FIRSTVAR:"; + "fred('23'"; i8 10; ")"; + "fred('23'"; i8 10; ")"; +); + +dnl Character encoding record. +7; 20; 1; 12; "windows-1252"; + +dnl Dictionary termination record. +999; 0; +]) +for variant in be le; do + AT_CHECK([sack --$variant sys-file.sack > sys-file.sav]) + AT_DATA([sys-file.sps], [dnl +GET FILE='sys-file.sav'. +]) + AT_CHECK([pspp -O format=csv sys-file.sps], [0], [dnl +warning: `sys-file.sav' near offset 0xf6: Duplicate attribute Attr1. + +warning: `sys-file.sav' near offset 0x125: Duplicate attribute fred. +]) +done +AT_CLEANUP + AT_SETUP([bad variable name in long string value label]) AT_KEYWORDS([sack synthetic system file negative]) AT_DATA([sys-file.sack], [dnl @@ -3817,3 +3948,29 @@ for variant in be le; do ]) done AT_CLEANUP + +# CVE-2017-10791. +# See also https://bugzilla.redhat.com/show_bug.cgi?id=1467004. +# See also https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=866890. +# See also https://security-tracker.debian.org/tracker/CVE-2017-10791. +# Found by team OWL337, using the collAFL fuzzer. +AT_SETUP([integer overflows in long string missing values]) +AT_KEYWORDS([system file negative]) +cp $top_srcdir/tests/data/CVE-2017-10791.sav . +AT_CHECK([pspp-convert -O csv -e ASCII CVE-2017-10791.sav -], [0], [], [dnl +`CVE-2017-10791.sav' near offset 0x217: Extension record subtype 21 ends unexpectedly. +]) +AT_CLEANUP + +# CVE-2017-10792. +# See also https://bugzilla.redhat.com/show_bug.cgi?id=1467005. +# See also https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=866890. +# See also https://security-tracker.debian.org/tracker/CVE-2017-10792. +# Reported by team OWL337, with fuzzer collAFL. +AT_SETUP([null dereference skipping bad extension record 18]) +AT_KEYWORDS([system file negative]) +cp $top_srcdir/tests/data/CVE-2017-10792.sav . +AT_CHECK([pspp-convert -O csv -e ASCII CVE-2017-10792.sav -], [0], [], [dnl +`CVE-2017-10792.sav' near offset 0x1c0: Record type 7, subtype 18 has bad size 4 (expected 1). +]) +AT_CLEANUP