diff options
Diffstat (limited to 'xfa/fxfa/fm2js/cxfa_fmtojavascriptdepth.h')
-rw-r--r-- | xfa/fxfa/fm2js/cxfa_fmtojavascriptdepth.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/xfa/fxfa/fm2js/cxfa_fmtojavascriptdepth.h b/xfa/fxfa/fm2js/cxfa_fmtojavascriptdepth.h index 14f87a68f5..f4cd1be472 100644 --- a/xfa/fxfa/fm2js/cxfa_fmtojavascriptdepth.h +++ b/xfa/fxfa/fm2js/cxfa_fmtojavascriptdepth.h @@ -10,13 +10,17 @@ class CXFA_FMToJavaScriptDepth { CXFA_FMToJavaScriptDepth() { depth_++; } ~CXFA_FMToJavaScriptDepth() { depth_--; } - bool IsWithinMaxDepth() const { return depth_ <= max_depth_; } + bool IsWithinMaxDepth() const { return depth_ <= kMaxDepth; } static void Reset(); private: + // Arbitarily picked by looking at how deep a translation got before hitting + // the getting fuzzer memory limits. Should be larger then |kMaxParseDepth| in + // cxfa_fmparser.cpp. + const unsigned long kMaxDepth = 5000; + static unsigned long depth_; - static unsigned long max_depth_; }; #endif // XFA_FXFA_FM2JS_CXFA_FMTOJAVASCRIPTDEPTH_H_ |