aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniil Cherednik <dan.cherednik@gmail.com>2016-04-22 01:35:31 +0300
committerDaniil Cherednik <dan.cherednik@gmail.com>2016-04-22 02:49:07 +0300
commit1c81b6e3d2b26c5e857fdce3131ed18ba6cf6ac5 (patch)
tree817ed5f83831b0962af07ad042598d0938fa86f2
parenteb5f6b9b5507607635726f85ef7e1842a7eaaf7e (diff)
downloadatracdenc-1c81b6e3d2b26c5e857fdce3131ed18ba6cf6ac5.tar.gz
fix memory corruption
-rw-r--r--src/bitstream/bitstream.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/bitstream/bitstream.cpp b/src/bitstream/bitstream.cpp
index 7de4873..f05b32c 100644
--- a/src/bitstream/bitstream.cpp
+++ b/src/bitstream/bitstream.cpp
@@ -20,7 +20,7 @@ void TBitStream::Write(unsigned long long val, int n) {
const int bytesPos = BitsUsed / 8;
const int overlap = BitsUsed % 8;
- if (bitsReq > 0) {
+ if (overlap || bitsReq > 0) {
Buf.resize(Buf.size() + (bitsReq / 8 + (overlap ? 2 : 1 )), 0);
}
TMix t;