Fix up potential overflows in size calculations by replacing instances
[pspp] / src / ChangeLog
index a790250a2fe8949bb85f3d35ad4cff0e8974467f..7e5f4057f8ed5a2b32bab4f5bd82b6da4af4ae71 100644 (file)
@@ -1,3 +1,344 @@
+Tue Oct 25 21:56:23 2005  Ben Pfaff  <blp@gnu.org>
+
+       Fix up potential overflows in size calculations by replacing
+       instances of xmalloc(x * sizeof *y) by xnmalloc(x, sizeof *y)
+       everywhere I could find them.  Similarly by xrealloc(), malloc().
+       (Order is important: xnmalloc(sizeof *y, x) will divide by 0 if x
+       is 0.)
+
+       * alloc.c: (nmalloc) New function.
+       (out_of_memory) Removed.  Replaced references by xalloc_die().
+
+       * sort.c: (allocate_cases) Fix segfault if memory allocation
+       fails.
+
+       * subclist.c: (subc_list_double_create) Use xnmalloc() instead of
+       malloc().
+       (subc_list_double_push) Use xnrealloc() instead of realloc().
+
+Wed Oct 26 08:43:51 WST 2005 John Darrington <john@darrington.wattle.id.au>
+
+       Dictionary abstraction part #2
+
+       * algorithm.c format.c str.c sysfile-info.c val.h var.h vars-atr.c:
+         Removed unnecessary #include directives
+
+Mon Oct 24 21:35:08 2005  Ben Pfaff  <blp@gnu.org>
+
+       * groff-font.c (font_msg): Use err_vmsg() instead of incorrectly
+       trying to pass a va_list to tmsg().  Thanks to Jason Stover for
+       reporting this bug.
+
+Mon Oct 24 21:24:15 2005  Ben Pfaff  <blp@gnu.org>
+
+       Work to get rid of GCC 4.0 warnings, part 2.
+
+       In many files, change `unsigned char' to `char'.  This often
+       requires adding casts to <ctype.h> functions.
+
+       * data-in.c: (parse_A) Use buf_copy_rpad().
+
+       * str.c: (str_copy_buf_trunc) New function.
+
+       * value-labels.c: (value_to_string) Fix mistaken use of strncpy(),
+       by rewriting.
+
+Mon Oct 24 13:42:32 WST 2005 John Darrington <john@darrington.wattle.id.au>
+
+       Moved some definitions to make it easier to abstract a dictionary 
+       from the rest of PSPP.
+
+       * format-prs.c lex-def.[ch]:  New files.
+
+       * Makefile.am lexer.[ch] dictionary.c vars-atr.c vfm.c algorithm.c 
+         format.c:  Moved some functions between modules.
+       
+Sun Oct 23 19:28:08 2005  Ben Pfaff  <blp@gnu.org>
+
+       Work to get rid of GCC 4.0 warnings, part 1.
+       
+       In many files, change count parameters to parse_variables(),
+       etc. from `int' to `size_t'.  Also change related variables and
+       struct members.  Also change messages as needed (e.g. %d to %u
+       with cast to unsigned).  Also change arithmetic as necessary
+       (e.g. n >= m - 1 to n + 1 >= m). 
+
+       * crosstabs.q: (crs_custom_tables) Check for size_t overflow in
+       multiplication.
+
+       * q2c.c: (dump_declarations) Generate code for size_t instead of
+       int.
+       
+Thu Oct 20 18:18:40 2005  Ben Pfaff  <blp@gnu.org>
+
+       * output.c: (outp_read_devices) Fix message.
+
+Sat Sep 17 11:13:13 2005  Ben Pfaff  <blp@gnu.org>
+
+       * matrix-data.c: (cmd_matrix_data) Change type of variable whose
+       address is passed to dict_get_vars() from size_t to int to match
+       John's change below.
+
+       * modify-vars.c: (validate_var_modification) Ditto.
+
+Mon Sep 12 19:26:06 WST 2005 John Darrington <john@darrington.wattle.id.au>
+
+       * dictionary.[ch]  Changed cnt from size_t* to int* since that's
+       what it's called as, and on  x86_64 machines they're different sizes.
+       
+       * str.c: (ds_vprintf) Copied va_list args so they can be re-used
+       
+Sun Aug 21 00:12:24 2005  Ben Pfaff  <blp@gnu.org>
+
+       * lexer.c: (lex_sbc_only_once) New function.
+       (lex_sbc_missing) New function.
+
+Sun Aug 21 00:00:47 2005  Ben Pfaff  <blp@gnu.org>
+
+       * case.h: (case_str) Make it return `unsigned char'.
+
+Sat Aug 20 23:56:14 2005  Ben Pfaff  <blp@gnu.org>
+
+       Revamp SAVE, XSAVE, EXPORT.  Add (or at least parse) all the
+       subcommands that we didn't support.  Fix bug 13911.  Fix bug
+       reported by Adam Pierson (COMPRESSED and other subcommands didn't
+       work on SAVE).  Refactor all related code.
+       
+       * command.def: Add XEXPORT command.
+
+       * dictionary.c: (dict_delete_scratch_vars) New function.
+
+       * get.c: (cmd_get) Fix parsing.
+       (struct save_trns) Removed.
+       (cmd_save_internal) Removed.
+       (cmd_save) Removed.
+       (do_write_case) Removed.
+       (save_write_case_func) Removed.
+       (save_trns_proc) Removed.
+       (save_trns_free) Removed.
+       (trim_dictionary) Removed.
+       (struct export_proc) Removed.
+       (cmd_export) Rewrote.
+       (export_write_case_func) Removed.
+       (export_proc_free) Removed.
+       (enum writer_type) New enum.
+       (enum command_type) New enum.
+       (struct any_writer) New struct.
+       (any_writer_destroy) New function.
+       (parse_write_command) New function.
+       (any_writer_write_case) New function.
+       (parse_output_proc) New function.
+       (output_proc) New function.
+       (cmd_save) Rewrote.
+       (cmd_xsave) Rewrote.
+       (struct output_trns) New struct.
+       (parse_output_trns) New function.
+       (output_trns_proc) New function.
+       (output_trns_free) New function.
+       (cmd_xsave) Rewrote.
+       (cmd_xexport) New function.
+       (parse_dict_trim) New function.
+       (struct mtf_proc) Change `by_cnt' member type to `int'.
+       (cmd_import) Rewrote.
+
+       * pfm-write.c: (struct pfm_writer) Add `digits' member.
+       (pfm_writer_default_options) New function.
+       (pfm_open_writer) Add `opts' argument and handle options.
+       (write_float) Write only as many digits as `digits' member says.
+       (format_trig_double) Limit base-10 precision to LDBL_DIG.
+
+       * pfm-write.h: (enum pfm_type) Moved here from pfm-read.h.
+       (struct pfm_write_options) New struct.
+
+       * sfm-write.c: (sfm_writer_default_options) New function.
+       (sfm_open_writer) Remove `compress', `omit_long_names' args.  Add
+       `opts' argument.  Implement options.
+
+       * sfm-write.h: (struct sfm_write_options) New struct.
+
+       * expressions/helpers.c: (copy_string) Make `old' arg `unsigned
+       char *' instead of `char *'.
+       
+Sat Aug  6 21:29:15 2005  Ben Pfaff  <blp@gnu.org>
+
+       * factor_stats.c: Needed <config.h> included earlier.
+
+       * percentiles.c: Needed to include <config.h>.
+
+       * val.h: Don't include "config.h".
+
+Sat Aug  6 21:26:27 2005  Ben Pfaff  <blp@gnu.org>
+
+       Clean up treatment of missing values by moving all the code into
+       one place.  All references to the missing value function were
+       updated, but only major changes are detailed below.
+
+       * Makefile.am: Add missing-values.c, missing-values.h to sources.
+
+       * apply-dict.c: (cmd_apply_dictionary) Use mv_resize().
+
+       * dictionary.c: (dict_create_var) Initialize `miss' member with
+       mv_init().
+       (dict_clone_var) Copy `miss' member with mv_copy().
+       
+       * get.c: (mtf_merge_dictionary) Use mv_copy().
+
+       * missing-values.c: New file.
+       
+       * missing-values.h: New file.
+
+       * mis-val.c: Rewrite.  New version implements updated semantics.
+
+       * pfm-read.c: (read_variables) Rewrite missing value handling.
+
+       * pfm-write.c: (write_variables) Rewrite missing value handling.
+
+       * sfm-read.c: (read_variables) Rewrite missing value handling.
+
+       * sfm-write.c: (write_variable) Rewrite missing value handling.
+
+       * sfmP.h: Include "magic.h" to get definition of
+       second_lowest_value.
+
+       * sysfile-info.c: (describe_variable) Rewrite missing value
+       handling.
+
+       * val.h: Include "magic.h" to get definition of
+       second_lowest_value.
+
+       * var.h: Include "missing-values.h".  Drop MISSING_* enums.
+       (struct variable) Remove `miss_type', `missing'.  Add `miss'.
+
+       * vars-atr.c: (is_num_user_missing) Removed--use
+       mv_is_num_user_missing().
+       (is_str_user_missing) Removed--use mv_is_str_user_missing().
+       (is_system_missing) Removed--use mv_is_value_system_missing().
+       (is_missing) Removed--use mv_is_value_missing().
+       (is_user_missing) Removed--use mv_is_value_user_missing().
+       
+Sun Jul 31 14:09:57 2005  Ben Pfaff  <blp@gnu.org>
+
+       Adopt use of gnulib for portability.
+
+       * Make.build: Add $(top_srcdir)/gl and $(top_builddir)/gl to
+       include path.
+
+       * Makefile.am: Remove bool.h, stat.h and change getline.[ch] to
+       getl.[ch] in pspp_SOURCES.  Remove libmisc, add libgl in
+       pspp_LDADD.
+
+       * In many source files, added an explicit inclusion of gettext.h
+       and definition of _ macro.  These are no longer in pref.h because
+       it interfered with definitions in a few gnulib source files.
+
+       * In many source files, changed #include "bool.h" to #include
+       <stdbool.h>, which is provided by gnulib.
+
+       * alloc.c: Removed functions defined in gnulib:
+       (xmalloc) Removed.
+       (xcalloc) Removed.
+       (xrealloc) Removed.
+       (xstrdup) Removed.
+       (out_of_memory) Redefined as wrapper for xalloc_die().
+
+       * alloc.h: Replace prototypes by #include "xalloc.h".
+
+       * casefile.c: Use full_read() and full_write() from gnulib instead
+       of our home-grown versions.
+       (full_read) Removed.
+       (full_write) Removed.
+
+       * getline.c: Renamed getl.c.
+
+       * getline.h: Renamed getl.h, updated all references.
+
+       * filename.c: (fn_readlink) Change to wrapper around xreadlink()
+       from gnulib.
+
+       * glob.c: Just #include <time.h> instead of the crazy rigmarole
+       here before.
+       (init_glob) Call set_program_name() to initial gnulib progname
+       module.
+
+       * html.c: (postopen) Use getlogin_r(), gethostname() from gnulib.
+
+       * permissions.c: Use "stat-macros.h" from gnulib.
+
+       * postscript.c: Just #include <time.h> instead of the crazy
+       rigmarole here before.
+
+       * q2c.c: (main) Make generated code #include "gettext.h".
+
+       * str.h: Get rid of most explicit declarations of standard
+       functions, in favor of including gnulib header files.
+
+       * expressions/evaluate.c: Ditto.
+
+       * expressions/operations.h.pl: Make generated code #include
+       <stdbool.h>, not "bool.h".
+
+Sat Jul 30 23:13:17 2005  Ben Pfaff  <blp@gnu.org>
+
+       * expressions/parse.c: (validate_function_args) Fix two msg() bugs
+       found by -Wformat.
+
+Sat Jul 30 23:10:01 2005  Ben Pfaff  <blp@gnu.org>
+
+       * expressions/evaluate.c: (expr_debug_print_postfix) Don't pass
+       null pointer to printf for %.*s.
+
+Sat Jul 30 23:05:33 2005  Ben Pfaff  <blp@gnu.org>
+
+       * vars-atr.c: (var_is_valid_name) Fix three msg() bugs found by
+       -Wformat.
+
+Sat Jul 30 22:58:33 2005  Ben Pfaff  <blp@gnu.org>
+
+       * rank.q: (parse_rank_function) Fix msg() bug found by -Wformat.
+
+Sat Jul 30 22:56:12 2005  Ben Pfaff  <blp@gnu.org>
+
+       * postscript.c: (postopen) Cast `char' to `unsigned char' before
+       passing to isspace().
+
+Sat Jul 30 22:52:09 2005  Ben Pfaff  <blp@gnu.org>
+
+       * pfm-read.c: (read_variables) Fix msg() bug found by -Wformat.
+
+Sat Jul 30 22:50:57 2005  Ben Pfaff  <blp@gnu.org>
+
+       * histogram.c: Include <config.h>.
+
+Sat Jul 30 22:48:50 2005  Ben Pfaff  <blp@gnu.org>
+
+       * get.c: (cmd_match_files) Fix msg() bug found by -Wformat.
+
+Sat Jul 30 22:46:10 2005  Ben Pfaff  <blp@gnu.org>
+
+       * format.c: (check_common_specifier) Fix msg() bug found by
+       -Wformat.
+       (check_output_specifier) Ditto.
+
+Sat Jul 30 22:43:57 2005  Ben Pfaff  <blp@gnu.org>
+
+       * file-handle.q: (cmd_file_handle) Fix msg() bug found by
+       -Wformat.
+
+Sat Jul 30 22:41:44 2005  Ben Pfaff  <blp@gnu.org>
+
+       * data-in.c: (parse_Z) [WORDS_BIGENDIAN] Don't declare buf[], to
+       avoid "unused variable" warning.
+
+Sat Jul 30 22:38:46 2005  Ben Pfaff  <blp@gnu.org>
+
+       * command.c: (find_word) Cast `char' to `unsigned char' before
+       passing to isspace().
+
+Sat Jul 30 22:36:29 2005  Ben Pfaff  <blp@gnu.org>
+
+       * case.c: (case_compare) Implement as delegating to
+       case_compare_2dict().
+
 Sat Jul 30 22:34:18 2005  Ben Pfaff  <blp@gnu.org>
 
        * algorithm.c: Inclusion of <alloca.h> is unneeded.
@@ -5,11 +346,11 @@ Sat Jul 30 22:34:18 2005  Ben Pfaff  <blp@gnu.org>
 Sat Jul 30 22:01:32 2005  Ben Pfaff  <blp@gnu.org>
 
        * Make.build: Don't append -ansi to AM_CFLAGS for GCC.  Using
-       -ansi changes the behavior of header files significantly.
-       It causes __STRICT_ANSI__ to be defined, and some headers
-       interpret that as cause to e.g. not use `long long' or
-       __attribute__.  The former example is bad when off_t is supposed
-       to be `long long'.
+       -ansi changes the behavior of header files significantly.  It
+       causes __STRICT_ANSI__ to be defined, and some headers interpret
+       that as cause to e.g. not use `long long' or __attribute__.  The
+       former example is bad when off_t is supposed to be `long long',
+       and the latter prevents -Wformat from working.
 
 Sun Jul 24 20:26:59 2005  Ben Pfaff  <blp@gnu.org>