From e36200bb8b2c0168f9aa51c7856a1d4fb5686f3d Mon Sep 17 00:00:00 2001 From: thebeing Date: Tue, 22 Jun 2010 15:56:30 +0000 Subject: [PATCH] Fix division by zero bug triggered by pointers to opaque structs. --- encoding2.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/encoding2.c b/encoding2.c index d1c4475..ea8f200 100644 --- a/encoding2.c +++ b/encoding2.c @@ -113,6 +113,11 @@ static void parse_struct(const char **type, type_parser callback, void *context) inline static void round_up(size_t *v, size_t b) { + if (0 == b) + { + return; + } + if (*v % b) { *v += b - (*v % b);