File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -1161,11 +1161,13 @@ static struct gfxinfo *php_handle_avif(php_stream * stream) {
1161
1161
}
1162
1162
/* }}} */
1163
1163
1164
- /* {{{ php_little2bigendian
1165
- * Reverse the bytes in a little-endian uint32, returning the big-endian equivalent.
1166
- * Adapted lovingly from libavif's read.c.
1164
+ /* {{{ php_ntohl
1165
+ * Convert a big-endian network uint32 to host order -
1166
+ * which may be either little-endian or big-endian.
1167
+ * Thanks to Rob Pike via Joe Drago:
1168
+ * https://commandcenter.blogspot.nl/2012/04/byte-order-fallacy.html
1167
1169
*/
1168
- static uint32_t php_little2bigendian (val ) {
1170
+ static uint32_t php_ntohl (val ) {
1169
1171
uint8_t data [4 ];
1170
1172
1171
1173
memcpy (& data , & val , sizeof (data ));
@@ -1204,7 +1206,7 @@ static int php_is_image_avif(php_stream * stream) {
1204
1206
return 0 ;
1205
1207
}
1206
1208
1207
- header_size = php_little2bigendian (header_size_reversed );
1209
+ header_size = php_ntohl (header_size_reversed );
1208
1210
1209
1211
// If the box type isn't "ftyp", it can't be an AVIF image.
1210
1212
if (php_stream_read (stream , box_type , 4 ) != 4 ) {
You can’t perform that action at this time.
0 commit comments