These made the problem a bit more obvious while tracking down bug #30689.
/* PSPP - a program for statistical analysis.
/* PSPP - a program for statistical analysis.
- Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
+ assert (before <= ds->n_columns);
+
ds->columns = xnrealloc (ds->columns,
ds->n_columns + 1, sizeof *ds->columns);
insert_element (ds->columns, ds->n_columns, sizeof *ds->columns, before);
ds->columns = xnrealloc (ds->columns,
ds->n_columns + 1, sizeof *ds->columns);
insert_element (ds->columns, ds->n_columns, sizeof *ds->columns, before);
void
datasheet_delete_columns (struct datasheet *ds, size_t start, size_t n)
{
void
datasheet_delete_columns (struct datasheet *ds, size_t start, size_t n)
{
+ assert (start + n <= ds->n_columns);
+
size_t old_start, size_t new_start,
size_t n)
{
size_t old_start, size_t new_start,
size_t n)
{
+ assert (old_start + n <= ds->n_columns);
+ assert (new_start + n <= ds->n_columns);
+
move_range (ds->columns, ds->n_columns, sizeof *ds->columns,
old_start, new_start, n);
move_range (ds->columns, ds->n_columns, sizeof *ds->columns,
old_start, new_start, n);