[PATCH] Fix segfault when using a filename on the commandline
Omari Stephens <
xsdg@...>
2012-02-27 06:24:54 GMT
Patch attached.
I don't know if this is the correct fix, but it does seem to work in the
limited testing that I've done. The problem only happens when
specifying an image filename on the commandline. Simply specifying a
directory works fine.
--xsdg
>From 4e29db57ca00952c7485758099034c058916331f Mon Sep 17 00:00:00 2001
From: Omari Stephens <xsdg@...>
Date: Mon, 27 Feb 2012 06:02:02 +0000
Subject: [PATCH] Fix segfault when a filename is specified on the commandline
Somehow, the file-specified-on-commandline codepath developed a
dependency on the options global, which hadn't been initialized
yet. This change simply moves the commandline parsing to below
the options variable initialization.
(gdb) r /PATH/TO/FILE.jpg
[...]
(gdb) bt
#0 0x00000000004559d2 in filelist_read_real (dir_path=<optimized out>,
files=0x7fffffffe638, dirs=0x0, follow_symlinks=<optimized out>)
at filedata.c:955
#1 0x0000000000455f0c in file_data_new_group (
path_utf8=0x773300 "/PATH/TO/FILE.jpg") at filedata.c:1040
#2 0x000000000047472f in parse_command_line_add_file (
file_path=<optimized out>, path=0x773da8, file=0x773db0,
(Continue reading)