From da060ba107fba8ef679393b5622b6de2f4790379 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Fri, 25 May 2018 16:01:49 +0000 Subject: [xfa] Restrict the editable xfa.change properties According to the XFA Spec only the cancelAction, selStart, selEnd and change properties of xfa.event are editable. This CL adds checking to early out if attempting to set any of the other properties. Bug: 1066 Change-Id: Ie6129e1f65de7584f0b5f3072a1acf6e25d44a2c Reviewed-on: https://pdfium-review.googlesource.com/32932 Commit-Queue: Ryan Harrison Reviewed-by: Ryan Harrison --- fxjs/xfa/cjx_eventpseudomodel.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'fxjs/xfa') diff --git a/fxjs/xfa/cjx_eventpseudomodel.cpp b/fxjs/xfa/cjx_eventpseudomodel.cpp index e652acb3e2..a6a876d81b 100644 --- a/fxjs/xfa/cjx_eventpseudomodel.cpp +++ b/fxjs/xfa/cjx_eventpseudomodel.cpp @@ -192,6 +192,13 @@ CJS_Return CJX_EventPseudoModel::reset( void CJX_EventPseudoModel::Property(CFXJSE_Value* pValue, XFA_Event dwFlag, bool bSetting) { + // Only the cancelAction, selStart, selEnd and change properties are writable. + if (bSetting && dwFlag != XFA_Event::CancelAction && + dwFlag != XFA_Event::SelectionStart && + dwFlag != XFA_Event::SelectionEnd && dwFlag != XFA_Event::Change) { + return; + } + CFXJSE_Engine* pScriptContext = GetDocument()->GetScriptContext(); if (!pScriptContext) return; -- cgit v1.2.3