Fix a crasher in CFDE_TxtEdtDoRecord_Insert::CFDE_TxtEdtDoRecord_Insert()
If a widget is barcode, we should set the data length
of barcode as the max length of input string.
BUG=pdfium:372
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1703963003 .
diff --git a/xfa/src/fxfa/src/app/xfa_fftextedit.cpp b/xfa/src/fxfa/src/app/xfa_fftextedit.cpp
index 0b5a701..2d2177b 100644
--- a/xfa/src/fxfa/src/app/xfa_fftextedit.cpp
+++ b/xfa/src/fxfa/src/app/xfa_fftextedit.cpp
@@ -259,6 +259,13 @@
bUpdate = TRUE;
}
}
+ if (m_pDataAcc->GetUIType() == XFA_ELEMENT_Barcode) {
+ int32_t nDataLen = 0;
+ if (eType == XFA_VALUEPICTURE_Edit)
+ m_pDataAcc->GetBarcodeAttribute_DataLength(nDataLen);
+ static_cast<CFWL_Edit*>(m_pNormalWidget)->SetLimit(nDataLen);
+ bUpdate = TRUE;
+ }
CFX_WideString wsText;
m_pDataAcc->GetValue(wsText, eType);
CFX_WideString wsOldText;