Ben Pfaff [Sun, 14 Oct 2018 19:31:52 +0000 (12:31 -0700)]
hash-functions: Avoid signed integer overflow.
cppcheck reported that 0xdeadbeef + 8 yielded signed integer overflow.
This is probably harmless, as long as the compiler doesn't do something
really strange, but it's even better if we just ensure that this
arithmetic is done as unsigned.
Ben Pfaff [Sat, 6 Oct 2018 22:12:07 +0000 (15:12 -0700)]
lexer: Fix details of journaling.
This fixes test 1075: ASCII driver syntax printback.
Reported by John Darrington and Jeremy Lavergne. Fixes: b4f585e70eca ("lexer: Fix buffer overread in journaling when source does not end in \n.") Fixes: e0f9210e814d ("lexer: Add support for embedded \0 bytes and missing trailing new-line.")
John Darrington [Sat, 29 Sep 2018 10:51:02 +0000 (12:51 +0200)]
Reference count struct dictionary.
This change:
* Adds a ref count to struct dictionary.
* Wraps dict_destroy in a ref-counted wrapper dict_unref.
* Replaces most calls to dict_destroy with dict_unref.
* Adds a new function dict_ref.
* Changes PsppireDict so take a reference to the struct dict it contains.
* Fixes some leaked dictionaries in PsppireImportAssistant.
Ben Pfaff [Sat, 29 Sep 2018 22:43:39 +0000 (15:43 -0700)]
lexer: Fix buffer overread in journaling when source does not end in \n.
An earlier commit removed the requirement that a source file ends in \n,
but the lexer still made that assumption. This is intended to fix the
problem. (Probably, some new tests should be added.)
Thanks to John Darrington for reporting the problem.
Fixes: e0f9210e814d ("lexer: Add support for embedded \0 bytes and missing trailing new-line.")
Ben Pfaff [Mon, 24 Sep 2018 03:42:07 +0000 (20:42 -0700)]
lexer: Add support for embedded \0 bytes and missing trailing new-line.
The lexer, at a low level, has not supported \0 bytes in the input stream
because it used such a byte as the end-of-input indicator. This caused
some awkwardness for the higher-level lexer, which had to remove and flag
\0 bytes as it read them. This caused a bug in the higher-level lexer,
which raised an error for each \0 byte it removed but did so when the
lexer was in an intermediate state, which could read uninitialized data.
This commit fixes the problem by adding support for \0 bytes to the
low-level lexer (segmenter). At the same time, it adds support for input
that doesn't end in a new-line character.
Bug #54664.
Thanks to Tianxiao Gu for reporting this bug.
Ben Pfaff [Mon, 24 Sep 2018 03:26:28 +0000 (20:26 -0700)]
DO REPEAT: Avoid relying on null terminators.
find_dummy_var() currently relies on the string passed in to have a null
terminator (even though it accepts a length). This is safe in the current
tree but an upcoming commit will not ensure that it is null-terminated, so
this commit removes the dependency.
Ben Pfaff [Sun, 23 Sep 2018 04:36:10 +0000 (21:36 -0700)]
sys-file-reader: Fix null deref on bad $@Role attribute.
When a variable had a bad $@Role attribute, this was effectively read as
an attribute without any values. This is the only way to produce such an
attribute. The system file reader assumed that every attribute had at
least one value and segfaulted if $@Role did not.
This commit fixes both the ultimate cause of the segfault, by dropping
attributes with no values, and the proximate cause, by ignoring $@Role
attributes with no values. Either fix by itself would be sufficient to
avoid the segfault.
Thanks to Tianxiao Gu for reporting the problem.
Bug #54687.
John Darrington [Fri, 6 Jul 2018 10:19:45 +0000 (12:19 +0200)]
ODS reader: Deal with case where /READNAMES vs. non-unity column spans.
* src/data/ods-reader.c (ods_make_reader): Populate var_specs for the entire
column span.
* tests/language/data-io/readnames.ods: New file
* tests/automake.mk: Add it.
* tests/language/data-io/get-data-spreadsheet.at: New test.
John Darrington [Wed, 4 Jul 2018 11:12:25 +0000 (13:12 +0200)]
Fix crash when attempting to add a new variable in the middle of the dictionary.
Fixes bug #52551.
* src/ui/gui/psppire-variable-sheet.c (change_var_property): Don't attempt to
alter a variable property if it's index is more than one below the last index.
k-means dialog - number of clusters gtkentry field not visible
The gtkentry field for the number of clusters in the k-means dialog
has a width of zero.
Number entries in this field are not visible with this width, although
the edit is done. I changed the width_chars to 5. Then the field is
visible in the dialog.
Ben Pfaff [Sun, 24 Sep 2017 02:44:48 +0000 (19:44 -0700)]
Avoid unfounded warnings from GCC 7.2.
GCC thinks that these printf formats can produce output longer than the
buffer that is available for them. I think that it is wrong, but it is
easy enough to use larger (or variable-length) buffers, so this commit
does that.
Ben Pfaff [Wed, 20 Sep 2017 15:36:18 +0000 (08:36 -0700)]
SORT VARIABLES: Improve stability of sort.
The sort was being made "stable" by comparing variables' addresses in
memory. There's nothing particularly predictable about that, especially
from one malloc implementation to another. This commit fixes the stability
by comparing the variables' dictionary indexes instead.
Ben Pfaff [Sat, 23 Sep 2017 17:37:35 +0000 (10:37 -0700)]
compiler: Fix test for "optimize" attribute.
This was introduced with GCC 4.4. This fixes build warnings compiling with
Clang, which pretends to be GCC 4.3 and does not support the "optimize"
attribute.
duplicate 'const' declaration specifier [-Wduplicate-decl-specifier]
extern const char const examples_dir[];
^
is shown. I removed the duplicate const declaration to avoid the
warning.
Ben Pfaff [Sun, 10 Sep 2017 17:31:59 +0000 (10:31 -0700)]
pspp.appdata.xml: Update and upgrade.
I added a number of elements suggested by Richard Hughes way back in
August 2016, plus some automatically added by "appstream-util upgrade".
It looks like the whole file changed because appstream-util reindented it,
but if you view ignoring white space changes you can see that the actual
changes are much smaller.