diff options
author | Phil Turnbull <philipturnbull@github.com> | 2017-07-06 10:59:09 -0400 |
---|---|---|
committer | Yuki Izumi <ashe@kivikakk.ee> | 2017-07-11 13:12:57 +1000 |
commit | c07bb95a832d041b8a61b48037a4e7a987314aca (patch) | |
tree | 7dc83e70b2faba108ac8fa07497f3e93b214b1f9 /src | |
parent | 4b83812e6780e4a58669272a7426f1491711ca8c (diff) |
Use unsigned integer when shifting
A UBSAN warning can be triggered when handling a long sequence of backticks:
src/commonmark.c:98:20: runtime error: left shift of 1 by 31 places cannot be represented in type 'int'
which can be triggered by:
```
| a | b |
| --- | --** `c```````````````````````````````- |
| c | `|d` \| e |
```
Diffstat (limited to 'src')
-rw-r--r-- | src/commonmark.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/commonmark.c b/src/commonmark.c index a9ba566..95a1ae5 100644 --- a/src/commonmark.c +++ b/src/commonmark.c @@ -93,7 +93,7 @@ static int shortest_unused_backtick_sequence(const char *code) { current++; } else { if (current > 0 && current < 32) { - used |= (1 << current); + used |= (1U << current); } current = 0; } |