@@ -173,7 +173,7 @@ PHP_FUNCTION(dom_characterdata_substring_data)
173
173
174
174
length = xmlUTF8Strlen (cur );
175
175
176
- if (offset < 0 || count < 0 || offset > length ) {
176
+ if (offset < 0 || count < 0 || ZEND_LONG_INT_OVFL ( offset ) || ZEND_LONG_INT_OVFL ( count ) || offset > length ) {
177
177
xmlFree (cur );
178
178
php_dom_throw_error (INDEX_SIZE_ERR , dom_get_strict_error (intern -> document ));
179
179
RETURN_FALSE ;
@@ -183,7 +183,7 @@ PHP_FUNCTION(dom_characterdata_substring_data)
183
183
count = length - offset ;
184
184
}
185
185
186
- substring = xmlUTF8Strsub (cur , offset , count );
186
+ substring = xmlUTF8Strsub (cur , ( int ) offset , ( int ) count );
187
187
xmlFree (cur );
188
188
189
189
if (substring ) {
@@ -257,14 +257,14 @@ PHP_FUNCTION(dom_characterdata_insert_data)
257
257
258
258
length = xmlUTF8Strlen (cur );
259
259
260
- if (offset < 0 || offset > length ) {
260
+ if (offset < 0 || ZEND_LONG_INT_OVFL ( offset ) || offset > length ) {
261
261
xmlFree (cur );
262
262
php_dom_throw_error (INDEX_SIZE_ERR , dom_get_strict_error (intern -> document ));
263
263
RETURN_FALSE ;
264
264
}
265
265
266
- first = xmlUTF8Strndup (cur , offset );
267
- second = xmlUTF8Strsub (cur , offset , length - offset );
266
+ first = xmlUTF8Strndup (cur , ( int ) offset );
267
+ second = xmlUTF8Strsub (cur , ( int ) offset , length - ( int ) offset );
268
268
xmlFree (cur );
269
269
270
270
xmlNodeSetContent (node , first );
@@ -304,14 +304,14 @@ PHP_FUNCTION(dom_characterdata_delete_data)
304
304
305
305
length = xmlUTF8Strlen (cur );
306
306
307
- if (offset < 0 || count < 0 || offset > length ) {
307
+ if (offset < 0 || count < 0 || ZEND_LONG_INT_OVFL ( offset ) || ZEND_LONG_INT_OVFL ( count ) || offset > length ) {
308
308
xmlFree (cur );
309
309
php_dom_throw_error (INDEX_SIZE_ERR , dom_get_strict_error (intern -> document ));
310
310
RETURN_FALSE ;
311
311
}
312
312
313
313
if (offset > 0 ) {
314
- substring = xmlUTF8Strsub (cur , 0 , offset );
314
+ substring = xmlUTF8Strsub (cur , 0 , ( int ) offset );
315
315
} else {
316
316
substring = NULL ;
317
317
}
@@ -320,7 +320,7 @@ PHP_FUNCTION(dom_characterdata_delete_data)
320
320
count = length - offset ;
321
321
}
322
322
323
- second = xmlUTF8Strsub (cur , offset + count , length - offset );
323
+ second = xmlUTF8Strsub (cur , ( int ) offset + ( int ) count , length - ( int ) offset );
324
324
substring = xmlStrcat (substring , second );
325
325
326
326
xmlNodeSetContent (node , substring );
@@ -361,14 +361,14 @@ PHP_FUNCTION(dom_characterdata_replace_data)
361
361
362
362
length = xmlUTF8Strlen (cur );
363
363
364
- if (offset < 0 || count < 0 || offset > length ) {
364
+ if (offset < 0 || count < 0 || ZEND_LONG_INT_OVFL ( offset ) || ZEND_LONG_INT_OVFL ( count ) || offset > length ) {
365
365
xmlFree (cur );
366
366
php_dom_throw_error (INDEX_SIZE_ERR , dom_get_strict_error (intern -> document ));
367
367
RETURN_FALSE ;
368
368
}
369
369
370
370
if (offset > 0 ) {
371
- substring = xmlUTF8Strsub (cur , 0 , offset );
371
+ substring = xmlUTF8Strsub (cur , 0 , ( int ) offset );
372
372
} else {
373
373
substring = NULL ;
374
374
}
@@ -378,7 +378,7 @@ PHP_FUNCTION(dom_characterdata_replace_data)
378
378
}
379
379
380
380
if (offset < length ) {
381
- second = xmlUTF8Strsub (cur , offset + count , length - offset );
381
+ second = xmlUTF8Strsub (cur , ( int ) offset + count , length - ( int ) offset );
382
382
}
383
383
384
384
substring = xmlStrcat (substring , (xmlChar * ) arg );
0 commit comments