mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
fileinfo: Followup fixes
Signed-off-by: Anatol Belski <ab@php.net>
This commit is contained in:
parent
c3eeab01ba
commit
bf93f1d824
14 changed files with 104 additions and 5417 deletions
|
@ -257716,7 +257716,7 @@ const unsigned char php_magic_database[6652944] = {
|
|||
0x6E, 0x74, 0x20, 0x62, 0x69, 0x74, 0x6D, 0x61, 0x70, 0x20, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69,
|
||||
0x63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x69, 0x6D, 0x61, 0x67, 0x65, 0x2F, 0x62, 0x6D, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x69, 0x6D, 0x61, 0x67, 0x65, 0x2F, 0x78, 0x2D, 0x6D, 0x73, 0x2D, 0x62, 0x6D, 0x70, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
|
@ -258021,8 +258021,8 @@ const unsigned char php_magic_database[6652944] = {
|
|||
0x70, 0x2C, 0x20, 0x4F, 0x53, 0x2F, 0x32, 0x20, 0x32, 0x2E, 0x78, 0x20, 0x66, 0x6F, 0x72, 0x6D,
|
||||
0x61, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x69, 0x6D, 0x61, 0x67, 0x65, 0x2F, 0x62, 0x6D,
|
||||
0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x69, 0x6D, 0x61, 0x67, 0x65, 0x2F, 0x78, 0x2D,
|
||||
0x6D, 0x73, 0x2D, 0x62, 0x6D, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
|
@ -258233,7 +258233,7 @@ const unsigned char php_magic_database[6652944] = {
|
|||
0x20, 0x50, 0x68, 0x6F, 0x74, 0x6F, 0x73, 0x68, 0x6F, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x69, 0x6D, 0x61, 0x67, 0x65, 0x2F, 0x62, 0x6D, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x69, 0x6D, 0x61, 0x67, 0x65, 0x2F, 0x78, 0x2D, 0x6D, 0x73, 0x2D, 0x62, 0x6D, 0x70, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
|
@ -258327,7 +258327,7 @@ const unsigned char php_magic_database[6652944] = {
|
|||
0x20, 0x50, 0x68, 0x6F, 0x74, 0x6F, 0x73, 0x68, 0x6F, 0x70, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20,
|
||||
0x61, 0x6C, 0x70, 0x68, 0x61, 0x20, 0x63, 0x68, 0x61, 0x6E, 0x6E, 0x65, 0x6C, 0x20, 0x6D, 0x61,
|
||||
0x73, 0x6B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x69, 0x6D, 0x61, 0x67, 0x65, 0x2F, 0x62, 0x6D, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x69, 0x6D, 0x61, 0x67, 0x65, 0x2F, 0x78, 0x2D, 0x6D, 0x73, 0x2D, 0x62, 0x6D, 0x70, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
|
@ -258444,8 +258444,8 @@ const unsigned char php_magic_database[6652944] = {
|
|||
0x70, 0x2C, 0x20, 0x57, 0x69, 0x6E, 0x64, 0x6F, 0x77, 0x73, 0x20, 0x33, 0x2E, 0x78, 0x20, 0x66,
|
||||
0x6F, 0x72, 0x6D, 0x61, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x69, 0x6D, 0x61, 0x67, 0x65, 0x2F, 0x62, 0x6D,
|
||||
0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x69, 0x6D, 0x61, 0x67, 0x65, 0x2F, 0x78, 0x2D,
|
||||
0x6D, 0x73, 0x2D, 0x62, 0x6D, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
|
|
|
@ -53,8 +53,10 @@ FILE_RCSID("@(#)$File: apprentice.c,v 1.297 2020/05/09 18:57:15 christos Exp $")
|
|||
#include "win32/unistd.h"
|
||||
#define strtoull _strtoui64
|
||||
#else
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#endif
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
|
@ -149,10 +151,7 @@ private uint16_t swap2(uint16_t);
|
|||
private uint32_t swap4(uint32_t);
|
||||
private uint64_t swap8(uint64_t);
|
||||
private char *mkdbname(struct magic_set *, const char *, int);
|
||||
private struct magic_map *apprentice_buf(struct magic_set *, struct magic *,
|
||||
size_t);
|
||||
private struct magic_map *apprentice_map(struct magic_set *, const char *);
|
||||
private int check_buffer(struct magic_set *, struct magic_map *, const char *);
|
||||
private void apprentice_unmap(struct magic_map *);
|
||||
private int apprentice_compile(struct magic_set *, struct magic_map *,
|
||||
const char *);
|
||||
|
@ -428,8 +427,10 @@ private int
|
|||
apprentice_1(struct magic_set *ms, const char *fn, int action)
|
||||
{
|
||||
struct magic_map *map;
|
||||
#ifndef COMPILE_ONLY
|
||||
struct mlist *ml;
|
||||
size_t i;
|
||||
#endif
|
||||
|
||||
if (magicsize != FILE_MAGICSIZE) {
|
||||
file_error(ms, 0, "magic element size %lu != %lu",
|
||||
|
@ -609,51 +610,6 @@ mlist_free(struct mlist *mlist)
|
|||
mlist_free_one(mlist);
|
||||
}
|
||||
|
||||
#ifndef COMPILE_ONLY
|
||||
/* void **bufs: an array of compiled magic files */
|
||||
protected int
|
||||
buffer_apprentice(struct magic_set *ms, struct magic **bufs,
|
||||
size_t *sizes, size_t nbufs)
|
||||
{
|
||||
size_t i, j;
|
||||
struct mlist *ml;
|
||||
struct magic_map *map;
|
||||
|
||||
if (nbufs == 0)
|
||||
return -1;
|
||||
|
||||
(void)file_reset(ms, 0);
|
||||
|
||||
init_file_tables();
|
||||
|
||||
for (i = 0; i < MAGIC_SETS; i++) {
|
||||
mlist_free(ms->mlist[i]);
|
||||
if ((ms->mlist[i] = mlist_alloc()) == NULL) {
|
||||
file_oomem(ms, sizeof(*ms->mlist[i]));
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < nbufs; i++) {
|
||||
map = apprentice_buf(ms, bufs[i], sizes[i]);
|
||||
if (map == NULL)
|
||||
goto fail;
|
||||
|
||||
for (j = 0; j < MAGIC_SETS; j++) {
|
||||
if (add_mlist(ms->mlist[j], map, j) == -1) {
|
||||
file_oomem(ms, sizeof(*ml));
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
fail:
|
||||
mlist_free_all(ms);
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* const char *fn: list of magic files and directories */
|
||||
protected int
|
||||
file_apprentice(struct magic_set *ms, const char *fn, int action)
|
||||
|
@ -2251,6 +2207,11 @@ parse(struct magic_set *ms, struct magic_entry *me, const char *line,
|
|||
if (check_format(ms, m) == -1)
|
||||
return -1;
|
||||
}
|
||||
#ifndef COMPILE_ONLY
|
||||
if (action == FILE_CHECK) {
|
||||
file_mdump(m);
|
||||
}
|
||||
#endif
|
||||
m->mimetype[0] = '\0'; /* initialise MIME type to none */
|
||||
return 0;
|
||||
}
|
||||
|
@ -3055,28 +3016,6 @@ eatsize(const char **p)
|
|||
*p = l;
|
||||
}
|
||||
|
||||
/*
|
||||
* handle a buffer containing a compiled file.
|
||||
*/
|
||||
private struct magic_map *
|
||||
apprentice_buf(struct magic_set *ms, struct magic *buf, size_t len)
|
||||
{
|
||||
struct magic_map *map;
|
||||
|
||||
if ((map = CAST(struct magic_map *, calloc(1, sizeof(*map)))) == NULL) {
|
||||
file_oomem(ms, sizeof(*map));
|
||||
return NULL;
|
||||
}
|
||||
map->len = len;
|
||||
map->p = buf;
|
||||
map->type = MAP_TYPE_USER;
|
||||
if (check_buffer(ms, map, "buffer") != 0) {
|
||||
apprentice_unmap(map);
|
||||
return NULL;
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/*
|
||||
* handle a compiled file.
|
||||
*/
|
||||
|
@ -3224,62 +3163,6 @@ error:
|
|||
return NULL;
|
||||
}
|
||||
|
||||
private int
|
||||
check_buffer(struct magic_set *ms, struct magic_map *map, const char *dbname)
|
||||
{
|
||||
uint32_t *ptr;
|
||||
uint32_t entries, nentries;
|
||||
uint32_t version;
|
||||
int i, needsbyteswap;
|
||||
|
||||
ptr = CAST(uint32_t *, map->p);
|
||||
if (*ptr != MAGICNO) {
|
||||
if (swap4(*ptr) != MAGICNO) {
|
||||
file_error(ms, 0, "bad magic in `%s'", dbname);
|
||||
return -1;
|
||||
}
|
||||
needsbyteswap = 1;
|
||||
} else
|
||||
needsbyteswap = 0;
|
||||
if (needsbyteswap)
|
||||
version = swap4(ptr[1]);
|
||||
else
|
||||
version = ptr[1];
|
||||
if (version != VERSIONNO) {
|
||||
file_error(ms, 0, "File %s supports only version %d magic "
|
||||
"files. `%s' is version %d", FILE_VERSION_MAJOR,
|
||||
VERSIONNO, dbname, version);
|
||||
return -1;
|
||||
}
|
||||
entries = CAST(uint32_t, map->len / sizeof(struct magic));
|
||||
if ((entries * sizeof(struct magic)) != map->len) {
|
||||
file_error(ms, 0, "Size of `%s' %" SIZE_T_FORMAT "u is not "
|
||||
"a multiple of %" SIZE_T_FORMAT "u",
|
||||
dbname, map->len, sizeof(struct magic));
|
||||
return -1;
|
||||
}
|
||||
map->magic[0] = CAST(struct magic *, map->p) + 1;
|
||||
nentries = 0;
|
||||
for (i = 0; i < MAGIC_SETS; i++) {
|
||||
if (needsbyteswap)
|
||||
map->nmagic[i] = swap4(ptr[i + 2]);
|
||||
else
|
||||
map->nmagic[i] = ptr[i + 2];
|
||||
if (i != MAGIC_SETS - 1)
|
||||
map->magic[i + 1] = map->magic[i] + map->nmagic[i];
|
||||
nentries += map->nmagic[i];
|
||||
}
|
||||
if (entries != nentries + 1) {
|
||||
file_error(ms, 0, "Inconsistent entries in `%s' %u != %u",
|
||||
dbname, entries, nentries + 1);
|
||||
return -1;
|
||||
}
|
||||
if (needsbyteswap)
|
||||
for (i = 0; i < MAGIC_SETS; i++)
|
||||
byteswap(map->magic[i], map->nmagic[i]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* handle an mmaped file.
|
||||
*/
|
||||
|
|
|
@ -237,7 +237,6 @@ der_tag(char *buf, size_t len, uint32_t tag)
|
|||
static int
|
||||
der_data(char *buf, size_t blen, uint32_t tag, const void *q, uint32_t len)
|
||||
{
|
||||
uint32_t i = 0;
|
||||
const uint8_t *d = CAST(const uint8_t *, q);
|
||||
switch (tag) {
|
||||
case DER_TAG_PRINTABLE_STRING:
|
||||
|
@ -255,7 +254,7 @@ der_data(char *buf, size_t blen, uint32_t tag, const void *q, uint32_t len)
|
|||
break;
|
||||
}
|
||||
|
||||
for (; i < len; i++) {
|
||||
for (uint32_t i = 0; i < len; i++) {
|
||||
uint32_t z = i << 1;
|
||||
if (z < blen - 2)
|
||||
snprintf(buf + z, blen - z, "%.2x", d[i]);
|
||||
|
|
|
@ -493,8 +493,6 @@ protected int file_is_tar(struct magic_set *, const struct buffer *);
|
|||
protected int file_softmagic(struct magic_set *, const struct buffer *,
|
||||
uint16_t *, uint16_t *, int, int);
|
||||
protected int file_apprentice(struct magic_set *, const char *, int);
|
||||
protected int buffer_apprentice(struct magic_set *, struct magic **,
|
||||
size_t *, size_t);
|
||||
protected int file_magicfind(struct magic_set *, const char *, struct mlist *);
|
||||
protected uint64_t file_signextend(struct magic_set *, struct magic *,
|
||||
uint64_t);
|
||||
|
|
|
@ -227,6 +227,8 @@ file_badread(struct magic_set *ms)
|
|||
file_error(ms, errno, "error reading");
|
||||
}
|
||||
|
||||
#ifndef COMPILE_ONLY
|
||||
|
||||
protected int
|
||||
file_separator(struct magic_set *ms)
|
||||
{
|
||||
|
@ -465,6 +467,7 @@ simple:
|
|||
|
||||
return m;
|
||||
}
|
||||
#endif
|
||||
|
||||
protected int
|
||||
file_reset(struct magic_set *ms, int checkloaded)
|
||||
|
|
|
@ -76,9 +76,6 @@ FILE_RCSID("@(#)$File: magic.c,v 1.112 2020/06/08 19:44:10 christos Exp $")
|
|||
#endif
|
||||
|
||||
private int unreadable_info(struct magic_set *, mode_t, const char *);
|
||||
#if 0
|
||||
private const char* get_default_magic(void);
|
||||
#endif
|
||||
private const char *file_or_stream(struct magic_set *, const char *, php_stream *);
|
||||
|
||||
#ifndef STDIN_FILENO
|
||||
|
@ -154,41 +151,6 @@ magic_list(struct magic_set *ms, const char *magicfile)
|
|||
return file_apprentice(ms, magicfile, FILE_LIST);
|
||||
}
|
||||
|
||||
#if 0
|
||||
private void
|
||||
close_and_restore(const struct magic_set *ms, const char *name, int fd,
|
||||
const zend_stat_t *sb)
|
||||
{
|
||||
if (fd == STDIN_FILENO || name == NULL)
|
||||
return;
|
||||
(void) close(fd);
|
||||
|
||||
if ((ms->flags & MAGIC_PRESERVE_ATIME) != 0) {
|
||||
/*
|
||||
* Try to restore access, modification times if read it.
|
||||
* This is really *bad* because it will modify the status
|
||||
* time of the file... And of course this will affect
|
||||
* backup programs
|
||||
*/
|
||||
#ifdef HAVE_UTIMES
|
||||
struct timeval utsbuf[2];
|
||||
(void)memset(utsbuf, 0, sizeof(utsbuf));
|
||||
utsbuf[0].tv_sec = sb->st_atime;
|
||||
utsbuf[1].tv_sec = sb->st_mtime;
|
||||
|
||||
(void) utimes(name, utsbuf); /* don't care if loses */
|
||||
#elif defined(HAVE_UTIME_H) || defined(HAVE_SYS_UTIME_H)
|
||||
struct utimbuf utbuf;
|
||||
|
||||
(void)memset(&utbuf, 0, sizeof(utbuf));
|
||||
utbuf.actime = sb->st_atime;
|
||||
utbuf.modtime = sb->st_mtime;
|
||||
(void) utime(name, &utbuf); /* don't care if loses */
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef COMPILE_ONLY
|
||||
|
||||
/*
|
||||
|
|
|
@ -44,8 +44,6 @@ FILE_RCSID("@(#)$File: print.c,v 1.88 2020/05/09 18:57:15 christos Exp $")
|
|||
#endif
|
||||
#include <time.h>
|
||||
|
||||
#define SZOF(a) (sizeof(a) / sizeof(a[0]))
|
||||
|
||||
#include "cdf.h"
|
||||
|
||||
#ifndef COMPILE_ONLY
|
||||
|
|
|
@ -1934,10 +1934,13 @@ file_strncmp(const char *s1, const char *s2, size_t len, size_t maxlen,
|
|||
}
|
||||
else if ((flags & STRING_COMPACT_WHITESPACE) &&
|
||||
isspace(*a)) {
|
||||
/* XXX Dirty. The data and the pattern is what is causing this.
|
||||
Revert _i for the next port and see if it still matters. */
|
||||
uint32_t _i = 0;
|
||||
a++;
|
||||
if (isspace(*b++)) {
|
||||
if (!isspace(*a))
|
||||
while (b < eb && isspace(*b))
|
||||
while (EXPECTED(_i++ < 2048) && b < eb && isspace(*b))
|
||||
b++;
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -1,81 +1,15 @@
|
|||
magic/Magdir/animation | 47 +++++++++++++++++++---------------------------
|
||||
magic/Magdir/images | 28 +++++++++++++--------------
|
||||
magic/Magdir/rpm | 1 +
|
||||
magic/Magdir/securitycerts | 2 ++
|
||||
4 files changed, 36 insertions(+), 42 deletions(-)
|
||||
|
||||
diff --git a/magic/Magdir/animation b/magic/Magdir/animation
|
||||
index aaf32dd4..5c9ee1d9 100644
|
||||
--- a/magic/Magdir/animation
|
||||
+++ b/magic/Magdir/animation
|
||||
diff -u magic.orig/Magdir/images magic/Magdir/images
|
||||
--- magic.orig/Magdir/images 2020-05-31 12:34:40.000000000 +0200
|
||||
+++ magic/Magdir/images 2020-07-05 20:00:41.664783368 +0200
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
-# $File: animation,v 1.71 2019/04/19 00:42:27 christos Exp $
|
||||
+# $File: animation,v 1.73 2019/07/05 19:20:38 christos Exp $
|
||||
# animation: file(1) magic for animation/movie formats
|
||||
-# $File: images,v 1.181 2020/05/30 23:49:03 christos Exp $
|
||||
+# $File: images,v 1.183 2020/06/26 17:08:32 christos Exp $
|
||||
# images: file(1) magic for image formats (see also "iff", and "c-lang" for
|
||||
# XPM bitmaps)
|
||||
#
|
||||
# animation formats
|
||||
@@ -445,36 +445,27 @@
|
||||
# modified by Joerg Jenderek
|
||||
# GRR the original test are too common for many DOS files
|
||||
# so don't accept as MP3 until we've tested the rate
|
||||
+# But also beat GEMDOS fonts
|
||||
0 beshort&0xFFFE 0xFFFA
|
||||
# rates
|
||||
->2 byte&0xF0 0x10 MPEG ADTS, layer III, v1, 32 kbps
|
||||
-!:mime audio/mpeg
|
||||
->2 byte&0xF0 0x20 MPEG ADTS, layer III, v1, 40 kbps
|
||||
-!:mime audio/mpeg
|
||||
->2 byte&0xF0 0x30 MPEG ADTS, layer III, v1, 48 kbps
|
||||
-!:mime audio/mpeg
|
||||
->2 byte&0xF0 0x40 MPEG ADTS, layer III, v1, 56 kbps
|
||||
-!:mime audio/mpeg
|
||||
->2 byte&0xF0 0x50 MPEG ADTS, layer III, v1, 64 kbps
|
||||
-!:mime audio/mpeg
|
||||
->2 byte&0xF0 0x60 MPEG ADTS, layer III, v1, 80 kbps
|
||||
-!:mime audio/mpeg
|
||||
->2 byte&0xF0 0x70 MPEG ADTS, layer III, v1, 96 kbps
|
||||
-!:mime audio/mpeg
|
||||
->2 byte&0xF0 0x80 MPEG ADTS, layer III, v1, 112 kbps
|
||||
-!:mime audio/mpeg
|
||||
->2 byte&0xF0 0x90 MPEG ADTS, layer III, v1, 128 kbps
|
||||
-!:mime audio/mpeg
|
||||
->2 byte&0xF0 0xA0 MPEG ADTS, layer III, v1, 160 kbps
|
||||
-!:mime audio/mpeg
|
||||
->2 byte&0xF0 0xB0 MPEG ADTS, layer III, v1, 192 kbps
|
||||
-!:mime audio/mpeg
|
||||
->2 byte&0xF0 0xC0 MPEG ADTS, layer III, v1, 224 kbps
|
||||
-!:mime audio/mpeg
|
||||
->2 byte&0xF0 0xD0 MPEG ADTS, layer III, v1, 256 kbps
|
||||
-!:mime audio/mpeg
|
||||
->2 byte&0xF0 0xE0 MPEG ADTS, layer III, v1, 320 kbps
|
||||
+>2 byte&0xF0 !0
|
||||
+>>2 byte&0xF0 !0xF0 MPEG ADTS, layer III, v1
|
||||
+!:strength +20
|
||||
!:mime audio/mpeg
|
||||
+>2 byte&0xF0 0x10 \b, 32 kbps
|
||||
+>2 byte&0xF0 0x20 \b, 40 kbps
|
||||
+>2 byte&0xF0 0x30 \b, 48 kbps
|
||||
+>2 byte&0xF0 0x40 \b, 56 kbps
|
||||
+>2 byte&0xF0 0x50 \b, 64 kbps
|
||||
+>2 byte&0xF0 0x60 \b, 80 kbps
|
||||
+>2 byte&0xF0 0x70 \b, 96 kbps
|
||||
+>2 byte&0xF0 0x80 \b, 112 kbps
|
||||
+>2 byte&0xF0 0x90 \b, 128 kbps
|
||||
+>2 byte&0xF0 0xA0 \b, 160 kbps
|
||||
+>2 byte&0xF0 0xB0 \b, 192 kbps
|
||||
+>2 byte&0xF0 0xC0 \b, 224 kbps
|
||||
+>2 byte&0xF0 0xD0 \b, 256 kbps
|
||||
+>2 byte&0xF0 0xE0 \b, 320 kbps
|
||||
# timing
|
||||
>2 byte&0x0C 0x00 \b, 44.1 kHz
|
||||
>2 byte&0x0C 0x04 \b, 48 kHz
|
||||
diff --git a/magic/Magdir/images b/magic/Magdir/images
|
||||
index 0e314ade..edf647d7 100644
|
||||
--- a/magic/Magdir/images
|
||||
+++ b/magic/Magdir/images
|
||||
@@ -30,22 +30,22 @@
|
||||
@@ -32,22 +32,22 @@
|
||||
# Prevent conflicts with CRI ADX.
|
||||
>(2.S-2) belong !0x28632943
|
||||
# skip more garbage like *.iso by looking for positive image type
|
||||
|
@ -112,10 +46,54 @@ index 0e314ade..edf647d7 100644
|
|||
# display tga bitmap image information
|
||||
0 name tga-image
|
||||
>2 ubyte <34 Targa image data
|
||||
diff --git a/magic/Magdir/rpm b/magic/Magdir/rpm
|
||||
index fa336c07..00bda501 100644
|
||||
--- a/magic/Magdir/rpm
|
||||
+++ b/magic/Magdir/rpm
|
||||
@@ -615,7 +615,7 @@
|
||||
0 leshort 40
|
||||
# skip bad samples like GAME by looking for valid number of color planes
|
||||
>12 uleshort 1 Device independent bitmap graphic
|
||||
-!:mime image/bmp
|
||||
+!:mime image/x-ms-bmp
|
||||
!:apple ????BMPp
|
||||
!:ext dib
|
||||
>>4 lelong x \b, %d x
|
||||
@@ -641,7 +641,7 @@
|
||||
>>18 leshort x \b, %d x
|
||||
>>20 leshort x %d
|
||||
>14 leshort 64 PC bitmap, OS/2 2.x format
|
||||
-!:mime image/bmp
|
||||
+!:mime image/x-ms-bmp
|
||||
!:apple ????BMPp
|
||||
!:ext bmp
|
||||
# image width and height fields are unsigned integers for OS/2
|
||||
@@ -662,7 +662,7 @@
|
||||
#>>(10.l) ubequad !0 \b, bits 0x%16.16llx
|
||||
# BITMAPV2INFOHEADER adds RGB bit masks
|
||||
>14 leshort 52 PC bitmap, Adobe Photoshop
|
||||
-!:mime image/bmp
|
||||
+!:mime image/x-ms-bmp
|
||||
!:apple ????BMPp
|
||||
!:ext bmp
|
||||
>>18 lelong x \b, %d x
|
||||
@@ -670,7 +670,7 @@
|
||||
>>28 leshort x %d
|
||||
# BITMAPV3INFOHEADER adds alpha channel bit mask
|
||||
>14 leshort 56 PC bitmap, Adobe Photoshop with alpha channel mask
|
||||
-!:mime image/bmp
|
||||
+!:mime image/x-ms-bmp
|
||||
!:apple ????BMPp
|
||||
!:ext bmp
|
||||
>>18 lelong x \b, %d x
|
||||
@@ -679,7 +679,7 @@
|
||||
>14 leshort 40
|
||||
# jump 4 bytes before end of file/header to skip fmt-116-signature-id-118.dib
|
||||
>>(2.l-4) ulong x PC bitmap, Windows 3.x format
|
||||
-!:mime image/bmp
|
||||
+!:mime image/x-ms-bmp
|
||||
!:apple ????BMPp
|
||||
>>>18 lelong x \b, %d x
|
||||
>>>22 lelong x %d
|
||||
diff -u magic.orig/Magdir/rpm magic/Magdir/rpm
|
||||
--- magic.orig/Magdir/rpm 2019-02-22 14:06:34.000000000 +0100
|
||||
+++ magic/Magdir/rpm 2020-07-05 19:38:02.720419674 +0200
|
||||
@@ -29,6 +29,7 @@
|
||||
>>8 beshort 17 SuperH
|
||||
>>8 beshort 18 Xtensa
|
||||
|
@ -124,10 +102,9 @@ index fa336c07..00bda501 100644
|
|||
|
||||
#delta RPM Daniel Novotny (dnovotny@redhat.com)
|
||||
0 string drpm Delta RPM
|
||||
diff --git a/magic/Magdir/securitycerts b/magic/Magdir/securitycerts
|
||||
index d315a157..301d3c3d 100644
|
||||
--- a/magic/Magdir/securitycerts
|
||||
+++ b/magic/Magdir/securitycerts
|
||||
diff -u magic.orig/Magdir/securitycerts magic/Magdir/securitycerts
|
||||
--- magic.orig/Magdir/securitycerts 2019-02-22 14:06:34.000000000 +0100
|
||||
+++ magic/Magdir/securitycerts 2020-07-05 19:38:02.720419674 +0200
|
||||
@@ -4,3 +4,5 @@
|
||||
0 search/1 -----BEGIN\ CERTIFICATE------ RFC1421 Security Certificate text
|
||||
0 search/1 -----BEGIN\ NEW\ CERTIFICATE RFC1421 Security Certificate Signing Request text
|
||||
|
|
|
@ -34,7 +34,7 @@ if ($t < 1) {
|
|||
Done
|
||||
--CLEAN--
|
||||
<?php
|
||||
@unlink(__DIR__.'/cve-2014-3538.data');
|
||||
//@unlink(__DIR__.'/cve-2014-3538.data');
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(%d) "%s"
|
||||
|
|
|
@ -24,7 +24,7 @@ array(%d) {
|
|||
["%s/resources/test.awk"]=>
|
||||
string(10) "text/plain"
|
||||
["%s/resources/test.bmp"]=>
|
||||
string(9) "image/bmp"
|
||||
string(14) "image/x-ms-bmp"
|
||||
["%s/resources/test.gif"]=>
|
||||
string(9) "image/gif"
|
||||
["%s/resources/test.jpg"]=>
|
||||
|
|
|
@ -13,14 +13,16 @@ echo "*** Testing finfo_file() : basic functionality ***\n";
|
|||
var_dump( finfo_file( $finfo, __FILE__) );
|
||||
var_dump( finfo_file( $finfo, __FILE__, FILEINFO_CONTINUE ) );
|
||||
var_dump( finfo_file( $finfo, $magicFile ) );
|
||||
var_dump( finfo_file( $finfo, $magicFile.chr(0).$magicFile) );
|
||||
try {
|
||||
var_dump( finfo_file( $finfo, $magicFile.chr(0).$magicFile) );
|
||||
} catch (\TypeError $e) {
|
||||
echo $e->getMessage() . \PHP_EOL;
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
--EXPECT--
|
||||
*** Testing finfo_file() : basic functionality ***
|
||||
string(28) "text/x-php; charset=us-ascii"
|
||||
string(%d) "PHP script, ASCII text%A"
|
||||
string(28) "text/plain; charset=us-ascii"
|
||||
|
||||
Warning: finfo_file(): Invalid path in %s%efinfo_file_basic.php on line %d
|
||||
bool(false)
|
||||
string(22) "PHP script, ASCII text"
|
||||
string(25) "text/plain; charset=utf-8"
|
||||
finfo_file(): Argument #1 ($finfo) must not contain null bytes
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue