Fix a Klocwork issue. 88/48088/1
authorVictor Cebollada <v.cebollada@samsung.com>
Mon, 14 Sep 2015 07:29:40 +0000 (08:29 +0100)
committerVictor Cebollada <v.cebollada@samsung.com>
Mon, 14 Sep 2015 07:32:22 +0000 (08:32 +0100)
* libunibreak can access a buffer out of range.

Change-Id: I0ad777213c7c185e2e62f0d35a931ebdf795c677
Signed-off-by: Victor Cebollada <v.cebollada@samsung.com>
text/dali/internal/libunibreak/linebreak.c

index 81c7aa6..62a8104 100644 (file)
@@ -533,8 +533,8 @@ static int get_lb_result_lookup(
     /* TODO: Rule LB21a, as introduced by Revision 28 of UAX#14, is not
      * yet implemented below. */
     int brk = LINEBREAK_UNDEFINED;
-    assert(lbpCtx->lbcCur <= LBP_RI);
-    assert(lbpCtx->lbcNew <= LBP_RI);
+    assert((lbpCtx->lbcCur > 0) && (lbpCtx->lbcCur <= LBP_RI));
+    assert((lbpCtx->lbcNew > 0) && (lbpCtx->lbcNew <= LBP_RI));
     switch (baTable[lbpCtx->lbcCur - 1][lbpCtx->lbcNew - 1])
     {
     case DIR_BRK: