Package: yasm
Version: 0.5.0-1
Severity: important
Tags: patch

Hi!

Dunno whether it is worth a bug report since it is already fixed in upstream SVN
repository but it has been reported against yasm in Ubuntu Feisty and it also
impacts yasm in Etch and Sid. The following information is what has been posted
in the Launchpad bug report [0].

When compiling VirtualBox, yasm crashes with a SIGFPE on:

 --- 8< ---
 yasm -f elf64 -DASM_FORMAT_ELF -D__YASM__ -w+orphan-labels -g dwarf2 -IPATM/
 -I/home/sebastien/virtualbox/vbox/include/
 -I/home/sebastien/virtualbox/vbox/src/VBox/VMM/
 -I/home/sebastien/virtualbox/vbox/out/linux.amd64/release/ -DVBOX -DVBOX_OSE
 -D__LINUX__ -D_FILE_OFFSET_BITS=64 -D__AMD64__ -DIN_RING3 -DHC_ARCH_BITS=64
 -DGC_ARCH_BITS=32 -DPIC -DIN_VMM_R3 -DIN_PDM_R3 -DIN_CFGM_R3 -DIN_IOM_R3
 -DIN_VM_R3 -DIN_CPUM_R3 -DIN_SELM_R3 -DIN_PGM_R3 -DIN_TRPM_R3 -DIN_MM_R3
 -DIN_DBG_R3 -DIN_DBGF_R3 -DIN_PATM_R3 -DIN_DIS_R3 -DIN_STAM_R3 -DIN_CSAM_R3
 -DIN_EM_R3 -DIN_TM_R3 -DIN_SSM_R3 -DIN_HWACCM_R3 -l
 
/home/sebastien/virtualbox/vbox/out/linux.amd64/release/obj/src/VBox/VMM/VMMR3/VMMAll/CPUMAllA.lst
 -o 
/home/sebastien/virtualbox/vbox/out/linux.amd64/release/obj/src/VBox/VMM/VMMR3/VMMAll/CPUMAllA.o
 /home/sebastien/virtualbox/vbox/src/VBox/VMM/VMMAll/CPUMAllA.asm
 --- 8< ---

Here is the stack trace:

 --- 8< ---
 #0  nasm_listfmt_output (listfmt=<value optimized out>, f=0x764c50, 
linemap=0x67a470, arch=<value optimized out>) at 
modules/listfmts/nasm/nasm-listfmt.c:219
        multiple = 0
        origp = (unsigned char *) 0x0
        bigbuf = (unsigned char *) 0x0
        size = 0
        offset = 1632
        p = (unsigned char *) 0x706f40 "Ð s"
        gap = 1
        bc = (yasm_bytecode *) 0x7198d0
        source = 0x719340 "times ($$-$) & ((32)-1) resb 1"
        line = 1682
        listline = 7368512
        buf = (unsigned char *) 0x77d4f0 "@Lv"
        info = {arch = 0x67a8d0, bcrelocs = {stqh_first = 0x0, stqh_last = 
0x7fff14e56b48}, next_reloc = 0x0, next_reloc_addr = 2}
        last_hist = (sectreloc *) 0x763b50
        reloc = <value optimized out>
        sect = (yasm_section *) 0x706f40
 #1  0x0000000000402bd2 in main (argc=<value optimized out>, argv=<value 
optimized out>) at frontends/yasm/yasm.c:690
        list = (FILE *) 0x764c50
        in = <value optimized out>
        obj = <value optimized out>
        object = (yasm_object *) 0x67a110
        def_sect = (yasm_section *) 0x67ae50
        i = <value optimized out>
        arch_error = <value optimized out>
        base_filename = 0x441e07 "H\215\005\036D#"
 #2  0x00002b0c95e8a8e4 in __libc_start_main () from /lib/libc.so.6
 #3  0x0000000000401629 in _start ()
 --- 8< ---

You can find the patch I have uploaded to Feisty attached to this bug report.

Cheers,

-- 
Jeremie

                             /* ``Failure is not an option.
                                It comes bundled with software.'' */

[0] https://launchpad.net/bugs/90436

-- System Information:
Debian Release: 4.0
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.20.3dedibox3
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Index: yasm-0.5.0/modules/listfmts/nasm/nasm-listfmt.c
===================================================================
--- yasm-0.5.0.orig/modules/listfmts/nasm/nasm-listfmt.c        2007-03-20 
19:53:26.000000000 -0700
+++ yasm-0.5.0/modules/listfmts/nasm/nasm-listfmt.c     2007-03-20 
19:56:12.000000000 -0700
@@ -205,7 +205,7 @@
            while (bc && bc->line == line) {
                /[EMAIL PROTECTED]@*/ /[EMAIL PROTECTED]@*/ unsigned char 
*bigbuf;
                unsigned long size = REGULAR_BUF_SIZE;
-               unsigned long multiple;
+               long multiple;
                unsigned long offset = bc->offset;
                unsigned char *origp, *p;
                int gap;
@@ -216,7 +216,10 @@
                bigbuf = yasm_bc_tobytes(bc, buf, &size, &gap, &info,
                                         nasm_listfmt_output_value, NULL);
                yasm_bc_get_multiple(bc, &multiple, NULL);
-               size /= multiple;
+               if (multiple <= 0)
+                   size = 0;
+               else
+                   size /= multiple;
 
                /* output bytes with reloc information */
                origp = bigbuf ? bigbuf : buf;

Reply via email to