X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=tests%2Fdata%2Fsys-file-reader.at;h=be4782284c0ef8c0a87d0994088c0fd7fe00e34c;hb=8e27b1a0dba7f33b7acb0d8894efe2045b0bb98f;hp=70cd84ea126ab3107a840608f14055634d910c34;hpb=26f3ffbb107db482e1f1f83dbea913462c56ba81;p=pspp diff --git a/tests/data/sys-file-reader.at b/tests/data/sys-file-reader.at index 70cd84ea12..be4782284c 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 @@ -2184,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 @@ -3064,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; ); @@ -3082,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 @@ -3854,3 +3906,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