Please find attached my gdb protocol -- may be something would come
useful. Issue still exists in current sid (0.92.0 of wmaker), and
wmsetbg pukes on default backgrounds of awesome (but I guess it works
for others well... may be it is architecture dependent ? mine is amd64):
/usr/share/awesome/themes/default/background.png: PNG image, 1920 x 1200, 
8-bit/color RGBA, non-interlaced

wmsetbg doesn't puke on other images though, such as
/home/yoh/.config/awesome/hotbrain.png: PNG image, 1680 x 1050, 8-bit/color 
RGB, non-interlaced

(made it RGBA -- also didn't puke)


-- 
                                  .-.
=------------------------------   /v\  ----------------------------=
Keep in touch                    // \\     (yoh@|www.)onerussian.com
Yaroslav Halchenko              /(   )\               ICQ#: 60653192
                   Linux User    ^^-^^    [175555]


(gdb) set args  -s -S /usr/share/awesome/themes/default/background.png
(gdb) r
Starting program: /usr/bin/wmsetbg -s -S 
/usr/share/awesome/themes/default/background.png
[Thread debugging using libthread_db enabled]
[New Thread 0x7fe738b2d6f0 (LWP 7124)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fe738b2d6f0 (LWP 7124)]
0x00007fe73873c790 in RLoadPNG (context=0x1ee3580, file=0x1ee3990 
"/usr/share/awesome/themes/default/background.png", index=0) at 
/tmp/wmaker-0.92.0/wrlib/png.c:197
197             png_rows[y] = alloca(png_get_rowbytes(png, pinfo));
(gdb) bt
#0  0x00007fe73873c790 in RLoadPNG (context=0x1ee3580, file=0x1ee3990 
"/usr/share/awesome/themes/default/background.png", index=0) at 
/tmp/wmaker-0.92.0/wrlib/png.c:197
#1  0x00007fe73872e379 in RLoadImage (context=0x1ee3580, file=0x1ee3990 
"/usr/share/awesome/themes/default/background.png", index=0) at 
/tmp/wmaker-0.92.0/wrlib/load.c:217
#2  0x0000000000402cae in loadImage (rc=0x1ee3580, file=0x1ee38f0 
"/usr/share/awesome/themes/default/background.png") at 
/tmp/wmaker-0.92.0/util/wmsetbg.c:172
#3  0x0000000000403d74 in parseTexture (rc=0x1ee3580, text=0x7fff40b5a550 
"(spixmap, \"/usr/share/awesome/themes/default/background.png\", gray20)") at 
/tmp/wmaker-0.92.0/util/wmsetbg.c:509
#4  0x000000000040684f in main (argc=4, argv=0x7fff40b5b6c8) at 
/tmp/wmaker-0.92.0/util/wmsetbg.c:1556
(gdb) bt full
#0  0x00007fe73873c790 in RLoadPNG (context=0x1ee3580, file=0x1ee3990 
"/usr/share/awesome/themes/default/background.png", index=0) at 
/tmp/wmaker-0.92.0/wrlib/png.c:197
        tmp = 0x0
        image = (RImage *) 0x1ee45e0
        f = (FILE *) 0x1ee3ae0
        png = (png_structp) 0x1ee3d20
        pinfo = (png_infop) 0x1ee4220
        einfo = (png_infop) 0x1ee4400
        bkcolor = (png_color_16p) 0x7fe738b344c8
        alpha = 4
        x = 0
        y = 1087
        i = 0
        gamma = 5.292397776572611e-260
        sgamma = 2.2000000000000002
        width = 1920
        height = 1200
        depth = 8
        junk = 0
        color_type = 6
        png_rows = (png_bytep *) 0x7fff40b57b40
        ptr = (unsigned char *) 0x2 <Address 0x2 out of bounds>
#1  0x00007fe73872e379 in RLoadImage (context=0x1ee3580, file=0x1ee3990 
"/usr/share/awesome/themes/default/background.png", index=0) at 
/tmp/wmaker-0.92.0/wrlib/load.c:217
        image = (RImage *) 0x0
        i = 8
        st = {st_dev = 32, st_ino = 6382688, st_nlink = 4205040, st_mode = 
1085650624, st_uid = 32767, st_gid = 0, __pad0 = 0, st_rdev = 0, st_size = 0, 
st_blksize = 140631063454346, st_blocks = 140733193388033, 
  st_atim = {tv_sec = 0, tv_nsec = 0}, st_mtim = {tv_sec = 140631046228184, 
tv_nsec = 140631061186392}, st_ctim = {tv_sec = 4267040, tv_nsec = 
140734279033568}, __unused = {140631063478690, 32389520, 0}}
        __PRETTY_FUNCTION__ = "RLoadImage"
#2  0x0000000000402cae in loadImage (rc=0x1ee3580, file=0x1ee38f0 
"/usr/share/awesome/themes/default/background.png") at 
/tmp/wmaker-0.92.0/util/wmsetbg.c:172
        path = 0x1ee3990 "/usr/share/awesome/themes/default/background.png"
        image = (RImage *) 0x1ee3820
#3  0x0000000000403d74 in parseTexture (rc=0x1ee3580, text=0x7fff40b5a550 
"(spixmap, \"/usr/share/awesome/themes/default/background.png\", gray20)") at 
/tmp/wmaker-0.92.0/util/wmsetbg.c:509
        color = {pixel = 18446744073709551615, red = 0, green = 0, blue = 0, 
flags = 0 '\0', pad = 0 '\0'}
        image = (RImage *) 0x0
        pixmap = 0
        iwidth = 4205040
        iheight = 0
        rcolor = {red = 255 '�', green = 255 '�', blue = 255 '�', alpha = 255 
'�'}
        texture = (BackgroundTexture *) 0x1ee3950
        texarray = (WMPropList *) 0x1ee3560
        val = (WMPropList *) 0x1ee3820
        count = 3
        tmp = 0x1ee38f0 "/usr/share/awesome/themes/default/background.png"
        type = 0x1ee3890 "spixmap"
#4  0x000000000040684f in main (argc=4, argv=0x7fff40b5b6c8) at 
/tmp/wmaker-0.92.0/util/wmsetbg.c:1556
        tex = (BackgroundTexture *) 0x7fff40b5b6c0
        buffer = "(spixmap, 
\"/usr/share/awesome/themes/default/background.png\", 
gray20)\000��\020\000\000\000\000\000\000\000\000�8�\177\000\000 
�...@�\177\000\000\220��@�\177\000\000\000\000\000\000\000\000\000\000�\210\2067�\177\000\000\003\000\000\000\000\000\000\000xY�8�\177\000\000m�\2248�\177",
 '\0' <repeats 14 times>, 
"@\0008\000\000\000\000\000\000\000\000\0006�\2248�\177\000\000 
�...@�\177\000\0000�\2248�\177\000\000_��@�\177\000\000P��@"...
        i = 4
        helperMode = 0
        rc = (RContext *) 0x1ee3580
        rattr = {flags = 163, render_mode = 0, colors_per_channel = 4, rgamma = 
0, ggamma = 1.40129846e-44, bgamma = 0, visualid = 32768, use_shared_memory = 
4, scaling_filter = 0, standard_colormap_mode = 1}
        style = 0x411ec4 "spixmap"
        back_color = 0x4125a9 "gray20"
        image_name = 0x7fff40b5cfab 
"/usr/share/awesome/themes/default/background.png"
        domain = 0x41259d "WindowMaker"
        update = 0
        cpc = 4
        render_mode = 0
        obey_user = 0
        texture = 0x7fff40b5a550 "(spixmap, 
\"/usr/share/awesome/themes/default/background.png\", gray20)"
        workspace = -1
(gdb) p pinfo
$2 = (png_infop) 0x1ee4220
*(gdb) p *pinfo
$3 = {width = 1920, height = 1200, valid = 130, rowbytes = 7680, palette = 0x0, 
num_palette = 0, num_trans = 0, bit_depth = 8 '\b', color_type = 6 '\006', 
compression_type = 0 '\0', filter_type = 0 '\0', 
  interlace_type = 0 '\0', channels = 4 '\004', pixel_depth = 32 ' ', 
spare_byte = 0 '\0', signature = "\211PNG\r\n\032\n", gamma = 0.449999988, 
srgb_intent = 0 '\0', num_text = 1, max_text = 9, text = 0x1ee4610, 
  mod_time = {year = 0, month = 0 '\0', day = 0 '\0', hour = 0 '\0', minute = 0 
'\0', second = 0 '\0'}, sig_bit = {red = 8 '\b', green = 8 '\b', blue = 8 '\b', 
gray = 0 '\0', alpha = 8 '\b'}, trans = 0x0, 
  trans_values = {index = 0 '\0', red = 0, green = 0, blue = 0, gray = 0}, 
background = {index = 0 '\0', red = 0, green = 0, blue = 0, gray = 0}, x_offset 
= 0, y_offset = 0, offset_unit_type = 0 '\0', 
  x_pixels_per_unit = 3543, y_pixels_per_unit = 3543, phys_unit_type = 1 
'\001', hist = 0x0, x_white = 0, y_white = 0, x_red = 0, y_red = 0, x_green = 
0, y_green = 0, x_blue = 0, y_blue = 0, pcal_purpose = 0x0, 
  pcal_X0 = 0, pcal_X1 = 0, pcal_units = 0x0, pcal_params = 0x0, pcal_type = 0 
'\0', pcal_nparams = 0 '\0', free_me = 16384, unknown_chunks = 0x0, 
unknown_chunks_num = 0, iccp_name = 0x0, iccp_profile = 0x0, 
  iccp_proflen = 0, iccp_compression = 0 '\0', splt_palettes = 0x0, 
splt_palettes_num = 0, scal_unit = 0 '\0', scal_pixel_width = 0, 
scal_pixel_height = 0, scal_s_width = 0x0, scal_s_height = 0x0, row_pointers = 
0x0, 
  int_gamma = 0, int_x_white = 0, int_y_white = 0, int_x_red = 0, int_y_red = 
0, int_x_green = 0, int_y_green = 0, int_x_blue = 0, int_y_blue = 0}
(gdb) call png_get_rowbytes(png, pinfo)
Cannot access memory at address 0x7fff4035d4a8
(gdb) l
192             alloca(0);
193     #endif
194             return NULL;
195         }
196         for (y=0; y<height; y++) {
197             png_rows[y] = alloca(png_get_rowbytes(png, pinfo));
198             if (!png_rows[y]) {
199                 RErrorCode = RERR_NOMEMORY;
200                 fclose(f);
201                 RReleaseImage(image);
(gdb) print y
$8 = 1087
(gdb) p height
$9 = 1200

(gdb) p png
$4 = (png_structp) 0x1ee3d20
(gdb) p *png
$5 = {jmpbuf = {{__jmpbuf = {4267040, 2117168273360134567, 4205040, 
140734279038656, 0, 0, 2117168273328677287, 2112541026912412071}, 
__mask_was_saved = 0, __saved_mask = {__val = {0 <repeats 16 times>}}}}, 
  error_fn = 0, warning_fn = 0, error_ptr = 0x0, write_data_fn = 0, 
read_data_fn = 0x7fe7371eae90, io_ptr = 0x1ee3ae0, read_user_transform_fn = 0, 
write_user_transform_fn = 0, user_transform_ptr = 0x0, 
  user_transform_depth = 0 '\0', user_transform_channels = 0 '\0', mode = 4101, 
flags = 64, transformations = 8192, zstream = {next_in = 0x0, avail_in = 0, 
total_in = 0, next_out = 0x1ee67e0 "gray20", avail_out = 8192, 
    total_out = 0, msg = 0x0, state = 0x1ee87f0, zalloc = 0x7fe7371dd450, zfree 
= 0x7fe7371dd5e0, opaque = 0x1ee3d20, data_type = 0, adler = 1, reserved = 0}, 
zbuf = 0x1ee67e0 "gray20", zbuf_size = 8192, 
  zlib_level = 0, zlib_method = 0, zlib_window_bits = 0, zlib_mem_level = 0, 
zlib_strategy = 0, width = 1920, height = 1200, num_rows = 1200, usr_width = 0, 
rowbytes = 7680, irowbytes = 7681, iwidth = 1920, 
  row_number = 0, prev_row = 0x1eecba0 "", row_buf = 0x1eead70 "", sub_row = 
0x0, up_row = 0x0, avg_row = 0x0, paeth_row = 0x0, row_info = {width = 0, 
rowbytes = 0, color_type = 0 '\0', bit_depth = 0 '\0', 
    channels = 0 '\0', pixel_depth = 0 '\0'}, idat_size = 43655, crc = 
900662814, palette = 0x0, num_palette = 0, num_trans = 0, chunk_name = "IDAT", 
compression = 0 '\0', filter = 0 '\0', interlaced = 0 '\0', 
  pass = 0 '\0', do_filter = 0 '\0', color_type = 6 '\006', bit_depth = 8 '\b', 
usr_bit_depth = 0 '\0', pixel_depth = 32 ' ', channels = 4 '\004', usr_channels 
= 0 '\0', sig_bytes = 8 '\b', filler = 0, 
  background_gamma_type = 0 '\0', background_gamma = 0, background = {index = 0 
'\0', red = 0, green = 0, blue = 0, gray = 0}, background_1 = {index = 0 '\0', 
red = 0, green = 0, blue = 0, gray = 0}, 
  output_flush_fn = 0, flush_dist = 0, flush_rows = 0, gamma_shift = 0, gamma = 
0.449999988, screen_gamma = 2.20000005, gamma_table = 0x1ee4770 "", 
gamma_from_1 = 0x0, gamma_to_1 = 0x0, gamma_16_table = 0x0, 
  gamma_16_from_1 = 0x0, gamma_16_to_1 = 0x0, sig_bit = {red = 8 '\b', green = 
8 '\b', blue = 8 '\b', gray = 0 '\0', alpha = 8 '\b'}, shift = {red = 0 '\0', 
green = 0 '\0', blue = 0 '\0', gray = 0 '\0', 
    alpha = 0 '\0'}, trans = 0x0, trans_values = {index = 0 '\0', red = 0, 
green = 0, blue = 0, gray = 0}, read_row_fn = 0, write_row_fn = 0, info_fn = 0, 
row_fn = 0, end_fn = 0, save_buffer_ptr = 0x0, 
  save_buffer = 0x0, current_buffer_ptr = 0x0, current_buffer = 0x0, 
push_length = 0, skip_length = 0, save_buffer_size = 0, save_buffer_max = 0, 
buffer_size = 0, current_buffer_size = 0, process_mode = 0, 
  cur_palette = 0, current_text_size = 0, current_text_left = 0, current_text = 
0x0, current_text_ptr = 0x0, palette_lookup = 0x0, dither_index = 0x0, hist = 
0x0, heuristic_method = 0 '\0', num_prev_filters = 0 '\0', 
  prev_filters = 0x0, filter_weights = 0x0, inv_filter_weights = 0x0, 
filter_costs = 0x0, inv_filter_costs = 0x0, time_buffer = 0x0, free_me = 0, 
user_chunk_ptr = 0x0, read_user_chunk_fn = 0, num_chunk_list = 0, 
  chunk_list = 0x0, rgb_to_gray_status = 0 '\0', rgb_to_gray_red_coeff = 0, 
rgb_to_gray_green_coeff = 0, rgb_to_gray_blue_coeff = 0, mng_features_permitted 
= 0, int_gamma = 0, filter_type = 0 '\0', 
  mmx_bitdepth_threshold = 0 '\0', mmx_rowbytes_threshold = 0, asm_flags = 0, 
mem_ptr = 0x0, malloc_fn = 0, free_fn = 0, big_row_buf = 0x1eead50 "", 
dither_sort = 0x0, index_to_palette = 0x0, palette_to_index = 0x0, 
  compression_type = 0 '\0', user_width_max = 1000000, user_height_max = 
1000000, unknown_chunk = {name = "\000\000\000\000", data = 0x0, size = 0, 
location = 0 '\0'}, old_big_row_buf_size = 7749, 
  old_prev_row_size = 7681, chunkdata = 0x0}
(gdb) p pinfo
$6 = (png_infop) 0x1ee4220
(gdb) p *pinfo
$7 = {width = 1920, height = 1200, valid = 130, rowbytes = 7680, palette = 0x0, 
num_palette = 0, num_trans = 0, bit_depth = 8 '\b', color_type = 6 '\006', 
compression_type = 0 '\0', filter_type = 0 '\0', 
  interlace_type = 0 '\0', channels = 4 '\004', pixel_depth = 32 ' ', 
spare_byte = 0 '\0', signature = "\211PNG\r\n\032\n", gamma = 0.449999988, 
srgb_intent = 0 '\0', num_text = 1, max_text = 9, text = 0x1ee4610, 
  mod_time = {year = 0, month = 0 '\0', day = 0 '\0', hour = 0 '\0', minute = 0 
'\0', second = 0 '\0'}, sig_bit = {red = 8 '\b', green = 8 '\b', blue = 8 '\b', 
gray = 0 '\0', alpha = 8 '\b'}, trans = 0x0, 
  trans_values = {index = 0 '\0', red = 0, green = 0, blue = 0, gray = 0}, 
background = {index = 0 '\0', red = 0, green = 0, blue = 0, gray = 0}, x_offset 
= 0, y_offset = 0, offset_unit_type = 0 '\0', 
  x_pixels_per_unit = 3543, y_pixels_per_unit = 3543, phys_unit_type = 1 
'\001', hist = 0x0, x_white = 0, y_white = 0, x_red = 0, y_red = 0, x_green = 
0, y_green = 0, x_blue = 0, y_blue = 0, pcal_purpose = 0x0, 
  pcal_X0 = 0, pcal_X1 = 0, pcal_units = 0x0, pcal_params = 0x0, pcal_type = 0 
'\0', pcal_nparams = 0 '\0', free_me = 16384, unknown_chunks = 0x0, 
unknown_chunks_num = 0, iccp_name = 0x0, iccp_profile = 0x0, 
  iccp_proflen = 0, iccp_compression = 0 '\0', splt_palettes = 0x0, 
splt_palettes_num = 0, scal_unit = 0 '\0', scal_pixel_width = 0, 
scal_pixel_height = 0, scal_s_width = 0x0, scal_s_height = 0x0, row_pointers = 
0x0, 
  int_gamma = 0, int_x_white = 0, int_y_white = 0, int_x_red = 0, int_y_red = 
0, int_x_green = 0, int_y_green = 0, int_x_blue = 0, int_y_blue = 0}


so, alloca seems to screw things up

(gdb) display y
1: y = 1085
(gdb) call png_get_rowbytes(png, pinfo)
$5 = 7680
(gdb) n
197             png_rows[y] = alloca(png_get_rowbytes(png, pinfo));
1: y = 1086
(gdb) call png_get_rowbytes(png, pinfo)
$6 = 7680
(gdb) n
198             if (!png_rows[y]) {
1: y = 1086
(gdb) call png_get_rowbytes(png, pinfo)
Cannot access memory at address 0x7fff6ec9ede8


Valgrind just confirms access to freed memory
==8529== Process terminating with default action of signal 11 (SIGSEGV)
==8529==  Access not within mapped region at address 0x7FE801918
==8529==    at 0x4E40790: RLoadPNG (png.c:197)
==8529==  If you believe this happened as a result of a stack overflow in your
==8529==  program's main thread (unlikely but possible), you can try to increase
==8529==  the size of the main thread stack using the --main-stacksize= flag.
==8529==  The main thread stack size used in this run was 8388608.
==8529== Stack overflow in thread 1: can't grow stack to 0x7fe801910
==8529== 
==8529== Process terminating with default action of signal 11 (SIGSEGV)
==8529==  Access not within mapped region at address 0x7FE801910
==8529==    at 0x4A1E554: _vgnU_freeres (vg_preloaded.c:56)
==8529==  If you believe this happened as a result of a stack overflow in your
==8529==  program's main thread (unlikely but possible), you can try to increase
==8529==  the size of the main thread stack using the --main-stacksize= flag.
==8529==  The main thread stack size used in this run was 8388608.

Attachment: signature.asc
Description: Digital signature

Reply via email to