bugPSPP - Bugs: bug #29872, Bivariate Correlation crash

 
 

bug #29872: Bivariate Correlation crash

Submitter:  Harry Thijssen <unknown_one>
Submitted:  Thu 13 May 2010 10:16:12 AM UTC
   
 
Category:  Graphical User Interface Severity:  5 - Average
Status:  Fixed Assigned to:  None
Open/Closed:  Closed Release:  None
Effort:  0.00
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Fri 21 May 2010 11:23:44 AM UTC, comment #9: 

I pushed both these patches.
Closing this item.

John Darrington <jmd>
Group administrator
Wed 19 May 2010 04:29:23 PM UTC, comment #8: 


> As I understand it, the gnulib *alloc routines are supposed to accept zero, without crashing. Perhaps we should report this as a bug on the gnulib list.


The xcalloc() function has this comment:


/* Allocate zeroed memory for N elements of S bytes, with error
   checking.  S must be nonzero.  */


I personally think that this divergence from calloc()'s behavior is undesirable, but it is at least documented.

Ben Pfaff <blp>
Group administrator
Wed 19 May 2010 04:12:22 PM UTC, comment #7: 

Thanks for analysing this.

Your patch will fix the problem where the dialog box is used, but won't have any effect if someone types in the syntax manually.

Performing bivariate correlation on just one variable is a valid (albeit not very useful) operation.

As I understand it, the gnulib *alloc routines are supposed to accept zero, without crashing.  Perhaps we should report this as a bug on the gnulib list.

Can you try the attached patch instead?

(file #20566)

John Darrington <jmd>
Group administrator
Wed 19 May 2010 02:40:08 PM UTC, comment #6: 

I get what is going on.
On file covariance.c:90-92, we have:

cov->n_cm = (n_vars * (n_vars - 1) ) / 2;

cov->cm = xcalloc (sizeof *cov->cm, cov->n_cm);

Since we only have one variable, the value of cov-> n_cm will be zero. On xcalloc.c:96 we have:

if ((! HAVE_GNU_CALLOC && xalloc_oversized (n, s))

On linux, HAVE_GNU_CALLOC is true, so the second part of this if if not being executed. But on windows this is false and then we execute xalloc_oversized passing zero as it second argument, which causes a division by zero at xalloc.h:77:

#define xalloc_oversized(n, s) \
  ((size_t) (sizeof (ptrdiff_t) <= sizeof (size_t) ? -1 : -2) / (s) < (n))

I think it should be fixed at high level, by not allowing the execution of bivariate correlation with only one variable selectec. The attached patch should do it.

(file #20565)

Michel Boaventura <michelboaventura>
Group Member
Wed 19 May 2010 12:46:17 PM UTC, comment #5: 

I can get the backtrace using wine:

=>0 0x00458134 xcalloc+0x14(n=0x0008, s=0) [/root/pspp-0.7.4-g360654/gl/xmalloc.c:96] in psppire (0x00bcee78)
  1 0x004cbc46 covariance_create+0xa5(n_vars=0x0001, vars=0xd14430, weight=(nil), exclude=MV_ANY) [/root/pspp-0.7.4-g360654/src/math/covariance.c:92] in psppire (0x00bcef38)
  2 0x0049f8f3 run_corr+0x32(r=0x2d0a10, opts=(nil), corr=(nil)) [/root/pspp-0.7.4-g360654/src/language/stats/correlations.c:284] in psppire (0x00bcefb8)
  3 0x004a07ea cmd_correlation+0x1c9(lexer=0x2d5298, ds=0x2eb890) [/root/pspp-0.7.4-g360654/src/language/stats/correlations.c:480] in psppire (0x00bcf048)
  4 0x0044ad09 cmd_parse_in_state+0x4b8(lexer=0x2d5298, ds=0x2eb890, state=CMD_STATE_DATA) [/root/pspp-0.7.4-g360654/src/language/command.c:227] in psppire (0x00bcf048)
  5 0x002d5298 (0x00bcf068)
  6 0x0040bed9 execute_syntax+0xc8(sss=0x2d5298) [/root/pspp-0.7.4-g360654/src/ui/gui/executor.c:80] in psppire (0x00bcf068)
  7 0x0044b1ea cmd_parse+0x39(lexer=0x2d5298, ds=0x2eb890) [/root/pspp-0.7.4-g360654/src/language/command.c:158] in psppire (0x00bcf0b8)
  8 0x0040bed9 execute_syntax+0xc8(sss=0x2dfa48) [/root/pspp-0.7.4-g360654/src/ui/gui/executor.c:80] in psppire (0x00bcf128)
  9 0x00408dd9 correlation_dialog+0x1e8(de=0x1d1090) [/root/pspp-0.7.4-g360654/src/ui/gui/correlation-dialog.c:125] in psppire (0x00bcf128)
  10 0x002dfa48 (0x00bcf1a8)

Michel Boaventura <michelboaventura>
Group Member
Wed 19 May 2010 08:15:51 AM UTC, comment #4: 

That is right. It only happens on MSWindows. Don't know why.

Harry Thijssen <unknown_one>
Wed 19 May 2010 08:07:37 AM UTC, comment #3: 

I'm not able to reproduce this (using GNU/Linux).

John Darrington <jmd>
Group administrator
Sat 15 May 2010 12:37:48 PM UTC, comment #2: 

I used the version of 2010-05-13 to check it before I filed the bug. So I guess it is not solved yet.

Harry Thijssen <unknown_one>
Fri 14 May 2010 07:00:36 PM UTC, comment #1: 

I seem to remember this was a problem some time ago which has since been fixed.  Can you try on Windoze with the latest master version.

John Darrington <jmd>
Group administrator
Thu 13 May 2010 10:16:12 AM UTC, original submission:  

On MSWindows, Bivariate Correlation crashes when only 1 variable is selected and OK is pressed. On openSUSE this doesn't crash and gives output.

Besides, the Bivariate Corrleation box selection box could be a bit bigger by default.

Harry Thijssen <unknown_one>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #20566:  alloc.path added by jmd (759B - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by blp (Posted a comment)
  • -email is unavailable- added by michelboaventura (Posted a comment)
  • -email is unavailable- added by jmd (Posted a comment)
  • -email is unavailable- added by unknown_one (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2010-05-21 jmd StatusCannot Reproduce Fixed
        Open/ClosedOpen Closed
    2010-05-19 jmd Attached File- Added alloc.path, #20566
    2010-05-19 michelboaventura Attached File- Added fix_correlation.patch, #20565
    2010-05-19 jmd StatusNone Cannot Reproduce

    Back to the top

    Powered by Savane 3.13-caa5.
    Corresponding source code