diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2018-03-02 10:06:22 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2018-03-02 10:14:36 +0900 |
| commit | a95b6d34aa41fc288422989010b240877d1e1a4b (patch) | |
| tree | 4b0a66bb3e11633706e96c182087dff66815550c /mrbgems | |
| parent | 097bfdcac573861567716e4247265becec6b249a (diff) | |
| download | mruby-a95b6d34aa41fc288422989010b240877d1e1a4b.tar.gz mruby-a95b6d34aa41fc288422989010b240877d1e1a4b.zip | |
Round up the `dstlen` value; fix #3949
The fix was proposed by https://hackerone.com/aerodudrizzt
Diffstat (limited to 'mrbgems')
| -rw-r--r-- | mrbgems/mruby-pack/src/pack.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/mrbgems/mruby-pack/src/pack.c b/mrbgems/mruby-pack/src/pack.c index a3ea77517..d96ef1002 100644 --- a/mrbgems/mruby-pack/src/pack.c +++ b/mrbgems/mruby-pack/src/pack.c @@ -729,7 +729,7 @@ pack_m(mrb_state *mrb, mrb_value src, mrb_value dst, mrb_int didx, long count, u count -= count % 3; } - dstlen = srclen / 3 * 4; + dstlen = (srclen+2) / 3 * 4; if (count > 0) { dstlen += (srclen / count) + ((srclen % count) == 0 ? 0 : 1); } |
