SetFormScriptLimits

表单、JavaScript 安全

描述

为表单脚本源长度、解释器操作、解析器嵌套、字符串值和对象属性访问配置独立限制

语法

Delphi

Function TPDFlib.SetFormScriptLimits(MaxScriptLength, MaxOperations, MaxNestingDepth, MaxStringLength, MaxPropertyAccesses: Integer): Integer;

ActiveX

Function PDFlib::SetFormScriptLimits(MaxScriptLength As Long, MaxOperations As Long, MaxNestingDepth As Long, MaxStringLength As Long, MaxPropertyAccesses As Long) As Long

自类型库版本 3.5 起在 IPDFlibrary4 上可用

DLL

int DLSetFormScriptLimits(int InstanceID, int MaxScriptLength, int MaxOperations, int MaxNestingDepth, int MaxStringLength, int MaxPropertyAccesses);

参数

MaxScriptLength源字符限制,范围从 1,024 到 1,048,576
MaxOperations解释器操作限制,范围从 64 到 1,000,000
MaxNestingDepth解析器嵌套限制,范围从 8 到 256
MaxStringLength每字符串字符限制,范围从 1,024 到 16,777,216
MaxPropertyAccesses对象属性访问限制,范围从 16 到 1,000,000

返回值

所有限制都被接受时返回 1;任一值超出其范围时返回 0 并置 LastErrorCode 708

备注

默认值为:源字符 65,536、操作 4,096、嵌套层级 64、字符串字符 1,048,576、属性访问 4,096

相同限制适用于直接字段事件执行、重新计算和依赖分析

这些可配置限制作用于 AcroForm JavaScript 子集;XFA FormCalc 另有一组固定边界,由 EvaluateXFAFormCalc 说明

另请参阅

GetFormScriptLimitsJSON, GetFormScriptDiagnostics, ExecuteFormFieldScriptEvent