]> granicus.if.org Git - yasm/commitdiff
* bytecode.c (yasm_bc_tobytes): *really* fix handling of bytecodes larger than provid...
authorPeter Johnson <peter@tortall.net>
Sun, 5 Feb 2006 02:47:56 +0000 (02:47 -0000)
committerPeter Johnson <peter@tortall.net>
Sun, 5 Feb 2006 02:47:56 +0000 (02:47 -0000)
The only way to cause this to happen is with incbin, and while we do have a test intended for this,
it doesn't actually check this functionality due to a change made to unbreak distcheck; next up is
figuring out a good test that will work for different source/build directories.

svn path=/trunk/yasm/; revision=1362

libyasm/bytecode.c

index 0b120f1cb7076224c5f90360c5a20ebc83980b7a..d3d039a22a0835228ba20da16f87504154793f0e 100644 (file)
@@ -1392,10 +1392,10 @@ yasm_bc_tobytes(yasm_bytecode *bc, unsigned char *buf, unsigned long *bufsize,
        *multiple = 1;
 
     datasize = bc->len / (*multiple);
-    *bufsize = datasize;
 
     /* special case for reserve bytecodes */
     if (bc->callback == &bc_reserve_callback) {
+       *bufsize = datasize;
        *gap = 1;
        return NULL;    /* we didn't allocate a buffer */
     }
@@ -1410,6 +1410,7 @@ yasm_bc_tobytes(yasm_bytecode *bc, unsigned char *buf, unsigned long *bufsize,
        origbuf = buf;
        destbuf = buf;
     }
+    *bufsize = datasize;
 
     if (!bc->callback)
        yasm_internal_error(N_("got empty bytecode in bc_tobytes"));