Round up the dstlen value; fix #3949

The fix was proposed by https://hackerone.com/aerodudrizzt
This commit is contained in:
Yukihiro "Matz" Matsumoto
2018-03-02 10:06:22 +09:00
parent 097bfdcac5
commit a95b6d34aa
+1 -1
View File
@@ -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);
}