summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Rühsen <tim.ruehsen@gmx.de>2017-08-01 11:15:10 +0200
committerTim Rühsen <tim.ruehsen@gmx.de>2017-08-01 11:15:10 +0200
commit16853b6973a1e72fee2b7cccda85472cb9951305 (patch)
treec4bf019e603f475463bd946fe8907baef42fac75
parent7669214302ed2308b1142e39a070b7ff7f358a5a (diff)
downloadlibidn2-16853b6973a1e72fee2b7cccda85472cb9951305.tar.gz
lib/bidi: Fix integer overflow (found by fuzzing)
-rw-r--r--lib/bidi.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/bidi.c b/lib/bidi.c
index 7582981..47b6ff0 100644
--- a/lib/bidi.c
+++ b/lib/bidi.c
@@ -30,6 +30,7 @@
#include "idn2.h"
+#include <sys/types.h>
#include <stdbool.h>
#include "bidi.h"
@@ -39,7 +40,7 @@
static bool
_isBidi (const uint32_t *label, size_t llen)
{
- while (llen-- > 0) {
+ for (; (ssize_t) llen > 0; llen--) {
int bc = uc_bidi_category (*label++);
if (bc == UC_BIDI_R || bc == UC_BIDI_AL || bc == UC_BIDI_AN)