tdf115103: find data source if sDataSource/sCommand are empty
[LibreOffice.git] / external / poppler / ubsan.patch.0
blobf6e4667dc133d871070ac3642350fb28e291eda6
1 --- poppler/Form.cc
2 +++ poppler/Form.cc
3 @@ -463,12 +463,11 @@
4  // FormField
5  //========================================================================
6  
7 -FormField::FormField(PDFDoc *docA, Object *aobj, const Ref& aref, FormField *parentA, std::set<int> *usedParents, FormFieldType ty)
8 +FormField::FormField(PDFDoc *docA, Object *aobj, const Ref& aref, FormField *parentA, FormFieldType ty)
9  {
10    doc = docA;
11    xref = doc->getXRef();
12    obj = aobj->copy();
13 -  Dict* dict = obj.getDict();
14    ref.num = ref.gen = 0;
15    type = ty;
16    parent = parentA;
17 @@ -483,7 +482,11 @@
18    hasQuadding = gFalse;
20    ref = aref;
23 +void FormField::init(std::set<int> *usedParents)
25 +  Dict* dict = obj.getDict();
26    //childs
27    Object obj1 = dict->lookup("Kids");
28    if (obj1.isArray()) {
29 @@ -803,9 +806,15 @@
30  //------------------------------------------------------------------------
31  // FormFieldButton
32  //------------------------------------------------------------------------
33 -FormFieldButton::FormFieldButton(PDFDoc *docA, Object *aobj, const Ref& ref, FormField *parent, std::set<int> *usedParents)
34 -  : FormField(docA, aobj, ref, parent, usedParents, formButton)
35 +FormFieldButton::FormFieldButton(PDFDoc *docA, Object *aobj, const Ref& ref, FormField *parent)
36 +  : FormField(docA, aobj, ref, parent, formButton)
37  {
40 +void FormFieldButton::init(std::set<int> *usedParents)
42 +  FormField::init(usedParents);
44    Dict* dict = obj.getDict();
45    active_child = -1;
46    noAllOff = false;
47 @@ -983,9 +992,15 @@
48  //------------------------------------------------------------------------
49  // FormFieldText
50  //------------------------------------------------------------------------
51 -FormFieldText::FormFieldText(PDFDoc *docA, Object *aobj, const Ref& ref, FormField *parent, std::set<int> *usedParents)
52 -  : FormField(docA, aobj, ref, parent, usedParents, formText)
53 +FormFieldText::FormFieldText(PDFDoc *docA, Object *aobj, const Ref& ref, FormField *parent)
54 +  : FormField(docA, aobj, ref, parent, formText)
55  {
58 +void FormFieldText::init(std::set<int> *usedParents)
60 +  FormField::init(usedParents);
62    Dict* dict = obj.getDict();
63    Object obj1;
64    content = NULL;
65 @@ -1076,9 +1091,15 @@
66  //------------------------------------------------------------------------
67  // FormFieldChoice
68  //------------------------------------------------------------------------
69 -FormFieldChoice::FormFieldChoice(PDFDoc *docA, Object *aobj, const Ref& ref, FormField *parent, std::set<int> *usedParents)
70 -  : FormField(docA, aobj, ref, parent, usedParents, formChoice)
71 +FormFieldChoice::FormFieldChoice(PDFDoc *docA, Object *aobj, const Ref& ref, FormField *parent)
72 +  : FormField(docA, aobj, ref, parent, formChoice)
73  {
76 +void FormFieldChoice::init(std::set<int> *usedParents)
78 +  FormField::init(usedParents);
80    numChoices = 0;
81    choices = NULL;
82    editedChoice = NULL;
83 @@ -1379,11 +1400,17 @@
84  //------------------------------------------------------------------------
85  // FormFieldSignature
86  //------------------------------------------------------------------------
87 -FormFieldSignature::FormFieldSignature(PDFDoc *docA, Object *dict, const Ref& ref, FormField *parent, std::set<int> *usedParents)
88 -  : FormField(docA, dict, ref, parent, usedParents, formSignature),
89 +FormFieldSignature::FormFieldSignature(PDFDoc *docA, Object *dict, const Ref& ref, FormField *parent)
90 +  : FormField(docA, dict, ref, parent, formSignature),
91      signature_type(adbe_pkcs7_detached),
92      signature(nullptr), signature_info(nullptr)
93  {
96 +void FormFieldSignature::init(std::set<int> *usedParents)
98 +  FormField::init(usedParents);
100    signature = NULL;
102    signature_info = new SignatureInfo();
103 @@ -1691,15 +1718,15 @@
105      Object obj2 = Form::fieldLookup(obj->getDict (), "FT");
106      if (obj2.isName("Btn")) {
107 -      field = new FormFieldButton(docA, obj, pref, parent, usedParents);
108 +      field = FormFieldButton::create(docA, obj, pref, parent, usedParents);
109      } else if (obj2.isName("Tx")) {
110 -      field = new FormFieldText(docA, obj, pref, parent, usedParents);
111 +      field = FormFieldText::create(docA, obj, pref, parent, usedParents);
112      } else if (obj2.isName("Ch")) {
113 -      field = new FormFieldChoice(docA, obj, pref, parent, usedParents);
114 +      field = FormFieldChoice::create(docA, obj, pref, parent, usedParents);
115      } else if (obj2.isName("Sig")) {
116 -      field = new FormFieldSignature(docA, obj, pref, parent, usedParents);
117 +      field = FormFieldSignature::create(docA, obj, pref, parent, usedParents);
118      } else { //we don't have an FT entry => non-terminal field
119 -      field = new FormField(docA, obj, pref, parent, usedParents);
120 +      field = FormField::create(docA, obj, pref, parent, usedParents);
121      }
123      return field;
124 --- poppler/Form.h
125 +++ poppler/Form.h
126 @@ -264,8 +264,16 @@
127  //------------------------------------------------------------------------
129  class FormField {
130 -public:
131 -  FormField(PDFDoc *docA, Object *aobj, const Ref& aref, FormField *parent, std::set<int> *usedParents, FormFieldType t=formUndef);
132 +protected:
133 +  FormField(PDFDoc *docA, Object *aobj, const Ref& aref, FormField *parent, FormFieldType t);
134 +  void init(std::set<int> *usedParents);
135 +public:
136 +  static FormField *create(PDFDoc *docA, Object *aobj, const Ref& aref, FormField *parent, std::set<int> *usedParents, FormFieldType t=formUndef)
137 +  {
138 +    FormField *f = new FormField(docA, aobj, aref, parent, t);
139 +    f->init(usedParents);
140 +    return f;
141 +  }
143    virtual ~FormField();
145 @@ -338,8 +346,16 @@
146  //------------------------------------------------------------------------
148  class FormFieldButton: public FormField {
149 -public:
150 -  FormFieldButton(PDFDoc *docA, Object *dict, const Ref& ref, FormField *parent, std::set<int> *usedParents);
151 +private:
152 +  FormFieldButton(PDFDoc *docA, Object *dict, const Ref& ref, FormField *parent);
153 +  void init(std::set<int> *usedParents);
154 +public:
155 +  static FormFieldButton *create(PDFDoc *docA, Object *dict, const Ref& ref, FormField *parent, std::set<int> *usedParents)
156 +  {
157 +    FormFieldButton *f = new FormFieldButton(docA, dict, ref, parent);
158 +    f->init(usedParents);
159 +    return f;
160 +  }
162    FormButtonType getButtonType () { return btype; }
164 @@ -384,8 +400,16 @@
165  //------------------------------------------------------------------------
167  class FormFieldText: public FormField {
168 -public:
169 -  FormFieldText(PDFDoc *docA, Object *dict, const Ref& ref, FormField *parent, std::set<int> *usedParents);
170 +private:
171 +  FormFieldText(PDFDoc *docA, Object *dict, const Ref& ref, FormField *parent);
172 +  void init(std::set<int> *usedParents);
173 +public:
174 +  static FormFieldText *create(PDFDoc *docA, Object *dict, const Ref& ref, FormField *parent, std::set<int> *usedParents)
175 +  {
176 +    FormFieldText *f = new FormFieldText(docA, dict, ref, parent);
177 +    f->init(usedParents);
178 +    return f;
179 +  }
180    
181    GooString* getContent () { return content; }
182    GooString* getContentCopy ();
183 @@ -422,8 +446,16 @@
184  //------------------------------------------------------------------------
186  class FormFieldChoice: public FormField {
187 -public:
188 -  FormFieldChoice(PDFDoc *docA, Object *aobj, const Ref& ref, FormField *parent, std::set<int> *usedParents);
189 +private:
190 +  FormFieldChoice(PDFDoc *docA, Object *aobj, const Ref& ref, FormField *parent);
191 +  void init(std::set<int> *usedParents);
192 +public:
193 +  static FormFieldChoice *create(PDFDoc *docA, Object *aobj, const Ref& ref, FormField *parent, std::set<int> *usedParents)
194 +  {
195 +    FormFieldChoice *f = new FormFieldChoice(docA, aobj, ref, parent);
196 +    f->init(usedParents);
197 +    return f;
198 +  }
200    ~FormFieldChoice();
202 @@ -491,8 +523,16 @@
204  class FormFieldSignature: public FormField {
205    friend class FormWidgetSignature;
206 -public:
207 -  FormFieldSignature(PDFDoc *docA, Object *dict, const Ref& ref, FormField *parent, std::set<int> *usedParents);
208 +private:
209 +  FormFieldSignature(PDFDoc *docA, Object *dict, const Ref& ref, FormField *parent);
210 +  void init(std::set<int> *usedParents);
211 +public:
212 +  static FormFieldSignature *create(PDFDoc *docA, Object *dict, const Ref& ref, FormField *parent, std::set<int> *usedParents)
213 +  {
214 +    FormFieldSignature *f = new FormFieldSignature(docA, dict, ref, parent);
215 +    f->init(usedParents);
216 +    return f;
217 +  }
219    // Use -1 for now as validationTime
220    SignatureInfo *validateSignature(bool doVerifyCert, bool forceRevalidation, time_t validationTime);
221 --- poppler/XRef.cc
222 +++ poppler/XRef.cc
223 @@ -293,6 +293,7 @@
224    xRefStream = gFalse;
225    scannedSpecialFlags = gFalse;
226    encrypted = gFalse;
227 +  encAlgorithm = cryptRC4;
228    permFlags = defPermFlags;
229    ownerPasswordOk = gFalse;
230    rootNum = -1;