Commit graph

315 commits

Author SHA1 Message Date
Niels Dossche
7b768485f3 Fix GH-10834: exif_read_data() cannot read smaller stream wrapper chunk sizes
php_stream_read() may return less than the requested amount of bytes by
design. This patch introduces a static function for exif which reads
from the stream in a loop until all the requested bytes are read.

For the test: Co-authored-by: dotpointer

Closes GH-10924.
2023-05-12 23:37:00 +02:00
Patrick Allaert
ac18dd0dc7 Prefer EXPECT over EXPECTF 2021-06-29 17:13:02 +02:00
Christoph M. Becker
139a73b5a4
Improve performance of AppVeyor test runs
We only load a minimum set of extensions, and rely on dynamic loading
of others due to `--EXTENSION--` triggers.  We do not run the imap,
ldap and snmp test suites, because most of the tests would be skipped
after timeouts anyway.

Closes GH-7150.
2021-06-14 23:36:17 +02:00
Nikita Popov
6600ad6067 Add some missing EXTENSIONS sections to misc tests 2021-06-14 14:52:44 +02:00
Nikita Popov
ea256a218b Add %0 format to run-tests.php
This format matches against null bytes, and prevents the test
expectation from being interpreted as binary data.

bless_tests.php will automatically replace \0 with %0 as well.
2021-05-29 11:33:13 +02:00
Max Semenik
bd9f4fa676 Migrate skip checks to --EXTENSIONS--, p2
For rationale, see https://github.com/php/php-src/pull/6787

Make extension checks lowercase, add a special case for opcache
that has internal name not matching .so filename.

Extensions migrated in part 2:
* dom
* exif
* fileinfo
* ffi
2021-04-01 12:08:24 +01:00
Máté Kocsis
4f42519571
Review parameter names in ext/exif
Closes GH-6256
2020-10-02 11:56:16 +02:00
Nikita Popov
c5401854fc Run tidy
This should fix most of the remaining issues with tabs and spaces
being mixed in tests.
2020-09-18 14:28:32 +02:00
Nikita Popov
7e339a335e Make null byte error a ValueError
Currently we treat paths with null bytes as a TypeError, which is
incorrect, and rather inconsistent, as we treat empty paths as
ValueError. We do this because the error is generated by zpp and
it's easier to always throw TypeError there.

This changes the zpp implementation to throw a TypeError only if
the type is actually wrong and throw ValueError for null bytes.
The error message is also split accordingly, to be more precise.

Closes GH-6094.
2020-09-08 15:23:23 +02:00
Nikita Popov
259af931e6 Promote warnings in exif
The only thing that can promoted are the path-related checked.
Everything else is input dependent and error-suppressing these
functions is both the typical and the recommended usage.
2020-09-08 11:51:19 +02:00
Nikita Popov
5f4b169be8 Merge branch 'PHP-7.4'
* PHP-7.4:
  Make MAX_IFD_NESTING_LEVEL an actual nesting level
2020-08-31 09:36:48 +02:00
Nikita Popov
c45985d266 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Make MAX_IFD_NESTING_LEVEL an actual nesting level
2020-08-31 09:32:55 +02:00
Nikita Popov
376bbbdf3b Make MAX_IFD_NESTING_LEVEL an actual nesting level
Currently we only ever increment ifd_nesting_level, so this ends up
being a limit on the total number of IFD tags and we regularly get
bug reports of it being exceeded. I think the intention behind this
limit was to prevent recursion stack overflow, and for that we only
need to check actual recursive usage. I've implemented that here,
and dropped the nesting limit down to a smaller value
(which still passes our tests).

However, it seems that we do also need to have a total limit on
the number of tags, as we don't catch some instances of infinite
looping otherwise. Add this as a separate limit with a higher
value, that should hopefully be sufficient.

This is expected to fix a number of bugs:

https://bugs.php.net/bug.php?id=78083
https://bugs.php.net/bug.php?id=78701
https://bugs.php.net/bug.php?id=79907
https://bugs.php.net/bug.php?id=80016
2020-08-31 09:28:59 +02:00
Nikita Popov
8694eb14f4 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix bug #75785 by attempt switching endianness on Maker's Note
2020-08-11 16:29:01 +02:00
Nikita Popov
5c5508698d Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix bug #75785 by attempt switching endianness on Maker's Note
2020-08-11 16:27:06 +02:00
Nawarian
2fa4ca95db Fix bug #75785 by attempt switching endianness on Maker's Note
Different manufacturer models may come with a
different endianness (motorola/intel) format. In
order to avoid a big refactor and a gigantic lookup
table, this commit simply attempts to switch the
endianness and proceed when values are acceptable.

Closes GH-5849.
2020-08-11 16:26:34 +02:00
Máté Kocsis
7aacc705d0
Add many missing closing PHP tags to tests
Closes GH-5958
2020-08-09 22:03:36 +02:00
Fabien Villepinte
0c6d06ecfa Replace EXPECTF when possible
Closes GH-5779
2020-06-29 21:31:44 +02:00
Máté Kocsis
b5c7a83dca
Remove unnecessary PHPDoc-alike blocks from tests
Closes GH-5759
2020-06-24 13:13:44 +02:00
Christoph M. Becker
63cb47a86b Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #79687: Sony picture - PHP Warning - Make, Model, MakerNotes
2020-06-13 18:33:17 +02:00
Christoph M. Becker
59e343c779 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79687: Sony picture - PHP Warning - Make, Model, MakerNotes
2020-06-13 18:32:15 +02:00
Christoph M. Becker
5621c5faf8 Fix #79687: Sony picture - PHP Warning - Make, Model, MakerNotes
Even if the length of a maker note does not match our expectations
(either because the maker note is corrupted, or because our
expectations do not quite match reality), there is no need to let
parsing fail; we can still go on parsing the other meta information.
2020-06-13 18:30:57 +02:00
Stanislav Malyshev
03bf4edbe8 Fix test 2020-03-16 22:42:15 -07:00
Stanislav Malyshev
9ed82b1f7b Fixed bug #79282 2020-03-16 22:42:15 -07:00
Stanislav Malyshev
1599f440a5 Fix test 2020-03-16 22:40:48 -07:00
Stanislav Malyshev
b9d32197cb Fixed bug #79282 2020-03-16 22:40:48 -07:00
Stanislav Malyshev
62e7b80267 Fix test 2020-03-16 22:40:00 -07:00
Stanislav Malyshev
25238bdf60 Fixed bug #79282 2020-03-16 22:40:00 -07:00
Nikita Popov
a939805641 Use serialize_precision for var_dump()
var_dump() is debugging functionality, so it should print
floating-point numbers accurately. We do this by switching
to serialize_precision, which (by default) will print with
as much precision as necessary to preserve the exact value
of the float.

This also affects debug_zval_dump().

Closes GH-5172.
2020-02-25 09:51:32 +01:00
Nikita Popov
f8d795820e Reindent phpt files 2020-02-03 22:52:20 +01:00
Máté Kocsis
d1764ca330
Make error messages more consistent by fixing capitalization
Closes GH-5066 As a first step, let's capitalize their initial letter when it is applicable.
2020-01-17 14:52:46 +01:00
Nikita Popov
d21ad4d955 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fixed bug #79046
2019-12-30 17:24:16 +01:00
Nikita Popov
d1537e506e Fixed bug #79046 2019-12-30 17:23:53 +01:00
Nikita Popov
f0d1a27951 Merge branch 'PHP-7.4'
* PHP-7.4:
  Avoid float to int cast UB in exif
2019-12-17 13:26:32 +01:00
Nikita Popov
dd997a40d0 Avoid float to int cast UB in exif 2019-12-17 13:26:05 +01:00
Stanislav Malyshev
6556916759 Merge branch 'PHP-7.4'
* PHP-7.4:
  Test fixes
2019-12-16 10:31:40 -08:00
Stanislav Malyshev
d82a2f6c21 Test fixes 2019-12-16 10:31:22 -08:00
Stanislav Malyshev
0dfff646a2 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix test
  Fix bug #78793
  Fix build - no model field anymore
  Fixed bug #78910
  Fix #78878: Buffer underflow in bc_shift_addsub
  Fix test
  Fix #78862: link() silently truncates after a null byte on Windows
  Fix #78863: DirectoryIterator class silently truncates after a null byte
  Fix #78943: mail() may release string with refcount==1 twice
2019-12-16 10:07:15 -08:00
Stanislav Malyshev
6b010b5d86 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix test
  Fix bug #78793
2019-12-16 10:05:02 -08:00
Stanislav Malyshev
5cb4686753 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix test
  Fix bug #78793
2019-12-16 10:04:03 -08:00
Stanislav Malyshev
6d5cddabaf Fix test 2019-12-16 10:03:43 -08:00
Stanislav Malyshev
c14eb8de97 Fix bug #78793 2019-12-16 01:14:58 -08:00
Stanislav Malyshev
d9f57e8316 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fixed bug #78910
  Fix #78878: Buffer underflow in bc_shift_addsub
  Fix test
  Fix #78862: link() silently truncates after a null byte on Windows
  Fix #78863: DirectoryIterator class silently truncates after a null byte
  Fix #78943: mail() may release string with refcount==1 twice
2019-12-16 00:39:37 -08:00
Stanislav Malyshev
a65b8abf2c Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fixed bug #78910
  Fix #78878: Buffer underflow in bc_shift_addsub
  Fix test
  Fix #78862: link() silently truncates after a null byte on Windows
  Fix #78863: DirectoryIterator class silently truncates after a null byte
2019-12-16 00:38:54 -08:00
Stanislav Malyshev
d348cfb96f Fixed bug #78910 2019-12-16 00:10:39 -08:00
Fabien Villepinte
a555cc0b3d Clean DONE tags from tests
Remove most of the `===DONE===` tags and its variations.
Keep `===DONE===` if the test output otherwise becomes empty.

Closes GH-4872.
2019-11-07 21:31:47 +01:00
Nikita Popov
49327e2e15 Merge branch 'PHP-7.4'
* PHP-7.4:
  Improve exif tag name fetching
  Implement a cache for exif tag name lookups
  Limit the amount of errors generated during exif parsing
2019-10-18 16:55:46 +02:00
Nikita Popov
650115c827 Improve exif tag name fetching 2019-10-18 16:55:05 +02:00
Nikita Popov
e5324a2484 Limit the amount of errors generated during exif parsing
Emitting errors is fairly expensive, to the point that parsing
a file with a huge number of invalid tags can take seconds.
Generating ten thousand errors is unlikely to help anybody, but
constitutes a potential DOS vector.
2019-10-18 16:54:49 +02:00
Christoph M. Becker
a11f85805a Merge branch 'PHP-7.4'
* PHP-7.4:
  Add missing SKIPIFs in exif tests
2019-10-08 14:13:23 +02:00