Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 412753 - media-gfx/xfig-3.2.5b-r2 segfaults in Edit menu
Summary: media-gfx/xfig-3.2.5b-r2 segfaults in Edit menu
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal normal (vote)
Assignee: No maintainer - Look at https://wiki.gentoo.org/wiki/Project:Proxy_Maintainers if you want to take care of it
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks: 472340
  Show dependency tree
 
Reported: 2012-04-20 08:31 UTC by Bernardo Costa
Modified: 2014-06-09 14:02 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Intermediate conversions to intptr_t before casting to pointers (xfig-3.2.5b-intptr_t.patch,13.33 KB, patch)
2012-04-20 08:36 UTC, Bernardo Costa
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Bernardo Costa 2012-04-20 08:31:46 UTC
When using the Edit menu to change the arrows of a line (or some other properties I did not investigate), Xfig segfaults.

This is probably due to integer-to-pointer-to-integer conversions in the callback arguments in XtAddCallback &co.

Reproducible: Always

Steps to Reproduce:
1. Lounch Xfig
2. Draw a line
3. Click on the Edit tool to modify the line
4. Select "Forward Arrow"

Actual Results:  
Xfig segfaults.

In gdb, the menu of possible arrows appears and then it segfaults, but I have no backtrace at the moment.

Expected Results:  
Have a "drop down menu" that shows different arrows, and select them.

This is probably caused by arguments passed as XtPointers (=void *), which are in fact integers, and in amd64 architectures this is not compatible.
Comment 1 Bernardo Costa 2012-04-20 08:36:02 UTC
Created attachment 309603 [details, diff]
Intermediate conversions to intptr_t before casting to pointers

I made this patch with a lot of "(intptr_t)", trying to get saner conversions. As it turned out, I also needed to get a XAW_INTERNATIONALIZATION defined for e_edit.c to properly compile, so I put it altogether so that people with up to date xaw3d can directly test.

It corrected the bug on the edit menu for me, but of course this kind of conversion could have even subtler side-effects...
Comment 2 Christoph Junghans gentoo-dev 2013-03-04 01:47:07 UTC
+  04 Mar 2013; Christoph Junghans <ottxor@gentoo.org>
+  +files/xfig-3.2.5b-darwin.patch, +files/xfig-3.2.5b-edit-menu.patch,
+  +files/xfig-3.2.5b-solaris.patch, +xfig-3.2.5b-r3.ebuild:
+  fixed bugs #412753 and #405475, added prefix support
Comment 3 Peter Volkov (RETIRED) gentoo-dev 2014-06-09 14:02:20 UTC
Guys, although but is fixed here is a heads up as I'm going to drop this patch. Reasons are:

1. I don't understand why this change of types even needed. After reading these threads
http://stackoverflow.com/questions/6326338/why-when-to-use-intptr-t-for-type-casting-in-c
http://stackoverflow.com/questions/9492798/using-intptr-t-instead-of-void
I understand that
"intptr_t is really for the rare occasions that you have to interpret pointers as integers (which they really aren't). Don't that if you mustn't."

2. I failed to reproduce bug and I'm not sure how this patch fixes it. 

So in xfig-3.2.5c I've dropped it. As I read changelog other crashes where fixed there, so, please, could you try xfig-3.2.5c and report if this problem still exits?