From 2074392c5cb15be2dec399c2a6efb2c60fbb671c Mon Sep 17 00:00:00 2001 From: Adam Silverstein Date: Fri, 26 Apr 2024 15:00:03 +0000 Subject: [PATCH] Media: fix potential error in class-avif-info.php::get_item_features(). Import upstream fix from libavifinfo, correcting a potential fatal error. Props yguyon. Fixes #60980. git-svn-id: https://develop.svn.wordpress.org/trunk@58049 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/class-avif-info.php | 2 +- tests/phpunit/data/images/avif-alpha-grid2x1.avif | Bin 0 -> 924 bytes tests/phpunit/tests/functions.php | 11 +++++++++++ tests/phpunit/tests/image/editor.php | 9 +++++++++ 4 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 tests/phpunit/data/images/avif-alpha-grid2x1.avif diff --git a/src/wp-includes/class-avif-info.php b/src/wp-includes/class-avif-info.php index 93280b3806..10fc1b68d1 100644 --- a/src/wp-includes/class-avif-info.php +++ b/src/wp-includes/class-avif-info.php @@ -175,7 +175,7 @@ class Features { if ( $tile->parent_item_id != $target_item_id ) { continue; } - $status = get_item_features( $tile->tile_item_id, $tile_depth + 1 ); + $status = $this->get_item_features( $tile->tile_item_id, $tile_depth + 1 ); if ( $status != NOT_FOUND ) { return $status; } diff --git a/tests/phpunit/data/images/avif-alpha-grid2x1.avif b/tests/phpunit/data/images/avif-alpha-grid2x1.avif new file mode 100644 index 0000000000000000000000000000000000000000..9a781e0f0c7c2da466b33ed262639e7b5dcef3be GIT binary patch literal 924 zcmZuvTWAwO6utXM8f#lhnqm~IX%(yW#{?l^@zFHF2lWMlpO)=z9#eLcWs}APKWr7X zLhFZrA|h19q7_mJL8?OOhlc)C1gU}#d=&&M)E89?@y>37Eo7FNbI;tl=iWOz0N@HI zGn$wpVZcFAC1JNp#PC7C+Yi8=R6|LT`fzNH%8G8902+~!Wt*Zxy2~l}=hp><(fZ>X<6e5xqEX6B08zFg$CJ zgs3#l6w!$sh%0fU@Un-YnZ?vLcLfhtQPBgmBC6(Bw5Ukc|EpnjG^T+PXJtiq>RHy}OA8suTlabS~8ZqS#^t;dkz@KMIFjT;YB?RbpuO1UrEfg`9 z4nZQ4CL}V6WJpa2c!nrM)H8xuz8X^z*3wWP(NyEU(8dSAF)Rlx&$DMa;7s5-###jy zp0^HEfz=**x3Y^kT3O`NmH@x|x|eePdJGA_HArf0fwcIOUZWA5SL7U|ZB@Scw07WG--fPKVP VJ)S>A{=B`n{o^Pz{HEuW>mM_4=WYN1 literal 0 HcmV?d00001 diff --git a/tests/phpunit/tests/functions.php b/tests/phpunit/tests/functions.php index 066ca13ad1..df1055c677 100644 --- a/tests/phpunit/tests/functions.php +++ b/tests/phpunit/tests/functions.php @@ -1525,6 +1525,17 @@ class Tests_Functions extends WP_UnitTestCase { 'mime' => 'image/avif', ), ), + // Grid AVIF. + array( + DIR_TESTDATA . '/images/avif-alpha-grid2x1.avif', + array( + 199, + 200, + IMAGETYPE_AVIF, + 'width="199" height="200"', + 'mime' => 'image/avif', + ), + ), ); return $data; diff --git a/tests/phpunit/tests/image/editor.php b/tests/phpunit/tests/image/editor.php index 5e857bf472..0ec837199b 100644 --- a/tests/phpunit/tests/image/editor.php +++ b/tests/phpunit/tests/image/editor.php @@ -447,6 +447,15 @@ class Tests_Image_Editor extends WP_Image_UnitTestCase { 'num_channels' => 4, ), ), + array( + DIR_TESTDATA . '/images/avif-alpha-grid2x1.avif', + array( + 'width' => 199, + 'height' => 200, + 'bit_depth' => 8, + 'num_channels' => 4, + ), + ), array( DIR_TESTDATA . '/images/colors_hdr_p3.avif', array(