bugPSPP - Bugs: bug #29872, Bivariate Correlation crash

 
 

bug #29872: Bivariate Correlation crash

Submitted by:  Harry Thijssen <unknown_one>
Submitted on:  Thu 13 May 2010 10:16:12 AM UTC  
 
Category: Graphical User InterfaceSeverity: 5 - Average
Status: FixedAssigned to: None
Open/Closed: ClosedRelease: None
Effort: 0.00

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

(Jump to the original submission 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>
Project 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:

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

Ben Pfaff <blp>
Project 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>
Project 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>
Project 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>
Project 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>
Project 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>
Project 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 File(s):
   
   
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
  • -unavailable- added by blp (Posted a comment)
  • -unavailable- added by michelboaventura (Posted a comment)
  • -unavailable- added by jmd (Posted a comment)
  • -unavailable- added by unknown_one (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 5 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 21 May 2010 11:23:44 AM UTCjmdStatusCannot Reproduce=>Fixed
      Open/ClosedOpen=>Closed
    Wed 19 May 2010 04:12:22 PM UTCjmdAttached File-=>Added alloc.path, #20566
    Wed 19 May 2010 02:40:08 PM UTCmichelboaventuraAttached File-=>Added fix_correlation.patch, #20565
    Wed 19 May 2010 08:07:37 AM UTCjmdStatusNone=>Cannot Reproduce

    Back to the top


    Powered by Savane 3.1-cleanup1