summaryrefslogtreecommitdiff
path: root/xfa/fxbarcode
diff options
context:
space:
mode:
authornpm <npm@chromium.org>2016-08-31 10:51:20 -0700
committerCommit bot <commit-bot@chromium.org>2016-08-31 10:51:20 -0700
commitfc9b11358a47e1dd9b257263c9457d7e53b9dd10 (patch)
tree6113ee84dfe056551380102f53c58b6ff0ed3e1c /xfa/fxbarcode
parentca90b8742ac780d492f96181bdd52b8d9c17a227 (diff)
downloadpdfium-fc9b11358a47e1dd9b257263c9457d7e53b9dd10.tar.xz
Move maxNumDataBytes and maxNumEcBytes calculation to fix crash
The blocks.Add will std::move the unique_ptrs, so the std::max calculations need to go before. Without this change, pdfium_test will crash when trying to render test/barcode_test.pdf with XFA enabled. Tested that after this change, barcode_test.pdf is rendered without crashing. Review-Url: https://codereview.chromium.org/2298833002
Diffstat (limited to 'xfa/fxbarcode')
-rw-r--r--xfa/fxbarcode/qrcode/BC_QRCoderEncoder.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/xfa/fxbarcode/qrcode/BC_QRCoderEncoder.cpp b/xfa/fxbarcode/qrcode/BC_QRCoderEncoder.cpp
index 7f332b671e..209a9656a6 100644
--- a/xfa/fxbarcode/qrcode/BC_QRCoderEncoder.cpp
+++ b/xfa/fxbarcode/qrcode/BC_QRCoderEncoder.cpp
@@ -885,10 +885,10 @@ void CBC_QRCoderEncoder::InterleaveWithECBytes(CBC_QRCoderBitVector* bits,
std::unique_ptr<CBC_CommonByteArray> ecBytes(
GenerateECBytes(dataBytes.get(), numEcBytesInBlosk, e));
BC_EXCEPTION_CHECK_ReturnVoid(e);
- blocks.Add(
- new CBC_QRCoderBlockPair(std::move(dataBytes), std::move(ecBytes)));
maxNumDataBytes = std::max(maxNumDataBytes, dataBytes->Size());
maxNumEcBytes = std::max(maxNumEcBytes, ecBytes->Size());
+ blocks.Add(
+ new CBC_QRCoderBlockPair(std::move(dataBytes), std::move(ecBytes)));
dataBytesOffset += numDataBytesInBlock;
}
if (numDataBytes != dataBytesOffset) {