From 3466293ed76d75652b3eb1099520b5b193af2d3f Mon Sep 17 00:00:00 2001 From: Peter Johnson <peter@tortall.net> Date: Thu, 3 Oct 2002 08:19:21 +0000 Subject: [PATCH] bc_tobytes(): Check for multiple of 0 and return with bufsize of 0. svn path=/trunk/yasm/; revision=727 --- libyasm/bytecode.c | 4 ++++ src/bytecode.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/libyasm/bytecode.c b/libyasm/bytecode.c index 3ec35ea2..976b4484 100644 --- a/libyasm/bytecode.c +++ b/libyasm/bytecode.c @@ -744,6 +744,10 @@ bc_tobytes(bytecode *bc, unsigned char *buf, unsigned long *bufsize, if (!num) InternalError(_("could not determine multiple in bc_tobytes")); *multiple = intnum_get_uint(num); + if (*multiple == 0) { + *bufsize = 0; + return NULL; + } } else *multiple = 1; diff --git a/src/bytecode.c b/src/bytecode.c index 3ec35ea2..976b4484 100644 --- a/src/bytecode.c +++ b/src/bytecode.c @@ -744,6 +744,10 @@ bc_tobytes(bytecode *bc, unsigned char *buf, unsigned long *bufsize, if (!num) InternalError(_("could not determine multiple in bc_tobytes")); *multiple = intnum_get_uint(num); + if (*multiple == 0) { + *bufsize = 0; + return NULL; + } } else *multiple = 1; -- 2.40.0