tags 498033 +pending
severity 498033 minor
thanks

Andrian, 

Thanks for the proposed patch!  Actually, you want to check to see if
theimage is NULL before the recursion check; otherwise, the in_routine
variable gets left set non-zero, which disables the command for the
rest of the xzgv run.  Also, this is a much more general problem that
affects not just the 'd' command (which you reported), but also the
's'command (which your patch didn't address but which had been
reported by the bug submitter), as well as 'm', 'd', 'f', and a number
of other bugs that try to operate on the currently selected image and
crash if one isn't selected.

Also, since this bug report falls into the "Doctor, doctor, it hurts
when I do that --- then don't that!", I've also reprioritized this bug
as "minor", since, according to the definition of minor, this bug is
"a problem which doesn't affect the package's usefulness", and
certainly NOT "a bug which has a major effect on the usability of a
package" (the definition of "important").  Remember, every time you
abuse bug priority levels, Cthulu kills a kitten.  :-)

The following patch has been checked into xzgv's source repository to
address the problem.

                                        - Ted

commit beee6e36a62dca10892351e76d156fbd6cb8393b
Author: tytso <[EMAIL PROTECTED]>
Date:   Tue Sep 9 12:58:25 2008 +0000

    Make sure an image has been selected before trying to operate on it
    
    This fixes a core-dumping bug if the user types 's', 'd', 'm', 'f',
    'r', or any other keys which cause xzgv to operate on an image if none
    is present -- for example, if xzgv is started without any arguments,
    and before an image has been selected.
    
    Addresses-Debian-Bug: #498033
    
    Signed-off-by: "Theodore Ts'o" <[EMAIL PROTECTED]>
    
    git-svn-id: https://xzgv.svn.sourceforge.net/svnroot/xzgv/[EMAIL PROTECTED] 
03f28338-6b37-0410-8b42-ade5b4edbc38

diff --git a/xzgv/src/main.c b/xzgv/src/main.c
index 69f89d1..04e9358 100644
--- a/xzgv/src/main.c
+++ b/xzgv/src/main.c
@@ -1705,6 +1705,9 @@ void xy_scaling_double(int do_x,int do_y)
 static int in_routine=0;
 int xtmp=xscaling,ytmp=yscaling,oldxsc=xscaling,oldysc=yscaling;
 
+/* if there's no image, don't do anything */
+if (!theimage) return;
+
 /* if recursed, don't bother */
 if(in_routine) return;
 in_routine=1;
@@ -1753,6 +1756,9 @@ void xy_scaling_add(int do_x,int do_y)
 static int in_routine=0;
 int xtmp=xscaling,ytmp=yscaling,oldxsc=xscaling,oldysc=yscaling;
 
+/* if there's no image, don't do anything */
+if (!theimage) return;
+
 /* if recursed, don't bother */
 if(in_routine) return;
 in_routine=1;
@@ -1801,6 +1807,9 @@ void xy_scaling_halve(int do_x,int do_y)
 static int in_routine=0;
 int xtmp=xscaling,ytmp=yscaling,oldxsc=xscaling,oldysc=yscaling;
 
+/* if there's no image, don't do anything */
+if (!theimage) return;
+
 /* if recursed, don't bother */
 if(in_routine) return;
 in_routine=1;
@@ -1852,6 +1861,9 @@ void xy_scaling_sub(int do_x,int do_y)
 static int in_routine=0;
 int xtmp=xscaling,ytmp=yscaling,oldxsc=xscaling,oldysc=yscaling;
 
+/* if there's no image, don't do anything */
+if (!theimage) return;
+
 /* if recursed, don't bother */
 if(in_routine) return;
 in_routine=1;
@@ -2102,6 +2114,7 @@ listen_to_toggles=1;
 
 void cb_flip(void)
 {
+if (!theimage) return;
 RECURSE_PROTECT_START;
 backend_flip_vert(theimage);
 orient_current_state=orient_state_flip[orient_current_state];
@@ -2112,6 +2125,7 @@ RECURSE_PROTECT_END;
 
 void cb_mirror(void)
 {
+if (!theimage) return;
 RECURSE_PROTECT_START;
 backend_flip_horiz(theimage);
 orient_current_state=orient_state_mirror[orient_current_state];
@@ -2122,6 +2136,7 @@ RECURSE_PROTECT_END;
 
 void cb_rot_cw(void)
 {
+if (!theimage) return;
 RECURSE_PROTECT_START;
 /* swap x and y scaling, since the effect if we don't do that
  * is of the image mysteriously changing. :-)
@@ -2136,6 +2151,7 @@ RECURSE_PROTECT_END;
 
 void cb_rot_acw(void)
 {
+if (!theimage) return;
 RECURSE_PROTECT_START;
 backend_rotate_acw(theimage);
 orient_current_state=orient_state_rot_acw[orient_current_state];
@@ -2147,6 +2163,7 @@ RECURSE_PROTECT_END;
 
 void cb_normal_orient(void)
 {
+if (!theimage) return;
 RECURSE_PROTECT_START;
 if(orient_current_state!=0)
   {



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to