Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2020-11-11 08:14:06 +0300
committerCampbell Barton <ideasman42@gmail.com>2020-11-11 08:14:06 +0300
commit2d60845786aeab099c61ffa42b7f72cccc68bff1 (patch)
treeaa3f17a33f029f9a8de69b081d219ee506e71f8e /source/blender/imbuf
parent99f56b4c16323f96c0cbf54e392fb509fcac5bda (diff)
Cleanup: pass header size to 'is_a' callbacks
No functional changes, prepare for fixing out-of-bounds access when reading headers.
Diffstat (limited to 'source/blender/imbuf')
-rw-r--r--source/blender/imbuf/intern/IMB_filetype.h22
-rw-r--r--source/blender/imbuf/intern/bmp.c10
-rw-r--r--source/blender/imbuf/intern/cineon/cineon_dpx.c8
-rw-r--r--source/blender/imbuf/intern/dds/dds_api.cpp11
-rw-r--r--source/blender/imbuf/intern/dds/dds_api.h3
-rw-r--r--source/blender/imbuf/intern/iris.c4
-rw-r--r--source/blender/imbuf/intern/jp2.c2
-rw-r--r--source/blender/imbuf/intern/jpeg.c4
-rw-r--r--source/blender/imbuf/intern/oiio/openimageio_api.cpp2
-rw-r--r--source/blender/imbuf/intern/oiio/openimageio_api.h2
-rw-r--r--source/blender/imbuf/intern/openexr/openexr_api.cpp4
-rw-r--r--source/blender/imbuf/intern/openexr/openexr_api.h2
-rw-r--r--source/blender/imbuf/intern/png.c6
-rw-r--r--source/blender/imbuf/intern/radiance_hdr.c4
-rw-r--r--source/blender/imbuf/intern/targa.c20
-rw-r--r--source/blender/imbuf/intern/tiff.c4
-rw-r--r--source/blender/imbuf/intern/util.c4
17 files changed, 57 insertions, 55 deletions
diff --git a/source/blender/imbuf/intern/IMB_filetype.h b/source/blender/imbuf/intern/IMB_filetype.h
index 520e810fe32..7bdbbb03227 100644
--- a/source/blender/imbuf/intern/IMB_filetype.h
+++ b/source/blender/imbuf/intern/IMB_filetype.h
@@ -32,7 +32,7 @@ typedef struct ImFileType {
void (*init)(void);
void (*exit)(void);
- int (*is_a)(const unsigned char *buf);
+ bool (*is_a)(const unsigned char *buf, const size_t size);
int (*ftype)(const struct ImFileType *type, const struct ImBuf *ibuf);
struct ImBuf *(*load)(const unsigned char *mem,
size_t size,
@@ -67,7 +67,7 @@ void imb_tile_cache_tile_free(struct ImBuf *ibuf, int tx, int ty);
/* Type Specific Functions */
/* png */
-int imb_is_a_png(const unsigned char *mem);
+bool imb_is_a_png(const unsigned char *mem, const size_t size);
struct ImBuf *imb_loadpng(const unsigned char *mem,
size_t size,
int flags,
@@ -75,7 +75,7 @@ struct ImBuf *imb_loadpng(const unsigned char *mem,
bool imb_savepng(struct ImBuf *ibuf, const char *filepath, int flags);
/* targa */
-int imb_is_a_targa(const unsigned char *buf);
+bool imb_is_a_targa(const unsigned char *buf, const size_t size);
struct ImBuf *imb_loadtarga(const unsigned char *mem,
size_t size,
int flags,
@@ -83,7 +83,7 @@ struct ImBuf *imb_loadtarga(const unsigned char *mem,
bool imb_savetarga(struct ImBuf *ibuf, const char *filepath, int flags);
/* iris */
-int imb_is_a_iris(const unsigned char *mem);
+bool imb_is_a_iris(const unsigned char *mem, const size_t size);
struct ImBuf *imb_loadiris(const unsigned char *mem,
size_t size,
int flags,
@@ -91,7 +91,7 @@ struct ImBuf *imb_loadiris(const unsigned char *mem,
bool imb_saveiris(struct ImBuf *ibuf, const char *filepath, int flags);
/* jp2 */
-int imb_is_a_jp2(const unsigned char *buf);
+bool imb_is_a_jp2(const unsigned char *buf, const size_t size);
struct ImBuf *imb_load_jp2(const unsigned char *mem,
size_t size,
int flags,
@@ -102,7 +102,7 @@ struct ImBuf *imb_load_jp2_filepath(const char *filepath,
bool imb_save_jp2(struct ImBuf *ibuf, const char *filepath, int flags);
/* jpeg */
-int imb_is_a_jpeg(const unsigned char *mem);
+bool imb_is_a_jpeg(const unsigned char *mem, const size_t size);
bool imb_savejpeg(struct ImBuf *ibuf, const char *filepath, int flags);
struct ImBuf *imb_load_jpeg(const unsigned char *buffer,
size_t size,
@@ -110,7 +110,7 @@ struct ImBuf *imb_load_jpeg(const unsigned char *buffer,
char colorspace[IM_MAX_SPACE]);
/* bmp */
-int imb_is_a_bmp(const unsigned char *buf);
+bool imb_is_a_bmp(const unsigned char *buf, const size_t size);
struct ImBuf *imb_bmp_decode(const unsigned char *mem,
size_t size,
int flags,
@@ -118,7 +118,7 @@ struct ImBuf *imb_bmp_decode(const unsigned char *mem,
bool imb_savebmp(struct ImBuf *ibuf, const char *filepath, int flags);
/* cineon */
-int imb_is_a_cineon(const unsigned char *buf);
+bool imb_is_a_cineon(const unsigned char *buf, const size_t size);
bool imb_save_cineon(struct ImBuf *buf, const char *filepath, int flags);
struct ImBuf *imb_load_cineon(const unsigned char *mem,
size_t size,
@@ -126,7 +126,7 @@ struct ImBuf *imb_load_cineon(const unsigned char *mem,
char colorspace[IM_MAX_SPACE]);
/* dpx */
-int imb_is_a_dpx(const unsigned char *buf);
+bool imb_is_a_dpx(const unsigned char *buf, const size_t size);
bool imb_save_dpx(struct ImBuf *buf, const char *filepath, int flags);
struct ImBuf *imb_load_dpx(const unsigned char *mem,
size_t size,
@@ -134,7 +134,7 @@ struct ImBuf *imb_load_dpx(const unsigned char *mem,
char colorspace[IM_MAX_SPACE]);
/* hdr */
-int imb_is_a_hdr(const unsigned char *buf);
+bool imb_is_a_hdr(const unsigned char *buf, const size_t size);
struct ImBuf *imb_loadhdr(const unsigned char *mem,
size_t size,
int flags,
@@ -143,7 +143,7 @@ bool imb_savehdr(struct ImBuf *ibuf, const char *filepath, int flags);
/* tiff */
void imb_inittiff(void);
-int imb_is_a_tiff(const unsigned char *buf);
+bool imb_is_a_tiff(const unsigned char *buf, const size_t size);
struct ImBuf *imb_loadtiff(const unsigned char *mem,
size_t size,
int flags,
diff --git a/source/blender/imbuf/intern/bmp.c b/source/blender/imbuf/intern/bmp.c
index 6d1726af608..9358b67b3ed 100644
--- a/source/blender/imbuf/intern/bmp.c
+++ b/source/blender/imbuf/intern/bmp.c
@@ -72,13 +72,13 @@ typedef struct BMPHEADER {
CHECK_HEADER_FIELD(_mem, "CI") || CHECK_HEADER_FIELD(_mem, "CP") || \
CHECK_HEADER_FIELD(_mem, "IC") || CHECK_HEADER_FIELD(_mem, "PT"))
-static int checkbmp(const uchar *mem)
+static bool checkbmp(const uchar *mem)
{
if (!CHECK_HEADER_FIELD_BMP(mem)) {
return 0;
}
- int ret_val = 0;
+ bool ok = false;
BMPINFOHEADER bmi;
uint u;
@@ -94,15 +94,15 @@ static int checkbmp(const uchar *mem)
if (bmi.biCompression == 0) {
u = LITTLE_SHORT(bmi.biBitCount);
if (u > 0 && u <= 32) {
- ret_val = 1;
+ ok = true;
}
}
}
- return ret_val;
+ return ok;
}
-int imb_is_a_bmp(const uchar *buf)
+bool imb_is_a_bmp(const uchar *buf, size_t UNUSED(size))
{
return checkbmp(buf);
}
diff --git a/source/blender/imbuf/intern/cineon/cineon_dpx.c b/source/blender/imbuf/intern/cineon/cineon_dpx.c
index 7907d648abe..8bbd9fbb285 100644
--- a/source/blender/imbuf/intern/cineon/cineon_dpx.c
+++ b/source/blender/imbuf/intern/cineon/cineon_dpx.c
@@ -188,7 +188,7 @@ bool imb_save_cineon(struct ImBuf *buf, const char *filepath, int flags)
return imb_save_dpx_cineon(buf, filepath, 1, flags);
}
-int imb_is_a_cineon(const unsigned char *buf)
+bool imb_is_a_cineon(const unsigned char *buf, size_t UNUSED(size))
{
return logImageIsCineon(buf);
}
@@ -198,7 +198,7 @@ ImBuf *imb_load_cineon(const unsigned char *mem,
int flags,
char colorspace[IM_MAX_SPACE])
{
- if (imb_is_a_cineon(mem)) {
+ if (imb_is_a_cineon(mem, size)) {
return imb_load_dpx_cineon(mem, size, 1, flags, colorspace);
}
return NULL;
@@ -209,7 +209,7 @@ bool imb_save_dpx(struct ImBuf *buf, const char *filepath, int flags)
return imb_save_dpx_cineon(buf, filepath, 0, flags);
}
-int imb_is_a_dpx(const unsigned char *buf)
+bool imb_is_a_dpx(const unsigned char *buf, size_t UNUSED(size))
{
return logImageIsDpx(buf);
}
@@ -219,7 +219,7 @@ ImBuf *imb_load_dpx(const unsigned char *mem,
int flags,
char colorspace[IM_MAX_SPACE])
{
- if (imb_is_a_dpx(mem)) {
+ if (imb_is_a_dpx(mem, size)) {
return imb_load_dpx_cineon(mem, size, 0, flags, colorspace);
}
return NULL;
diff --git a/source/blender/imbuf/intern/dds/dds_api.cpp b/source/blender/imbuf/intern/dds/dds_api.cpp
index d8bcca7e1f5..78ce8b5ee9b 100644
--- a/source/blender/imbuf/intern/dds/dds_api.cpp
+++ b/source/blender/imbuf/intern/dds/dds_api.cpp
@@ -72,18 +72,19 @@ bool imb_save_dds(struct ImBuf *ibuf, const char *name, int /*flags*/)
return true;
}
-int imb_is_a_dds(const unsigned char *mem) /* note: use at most first 32 bytes */
+/* note: use at most first 32 bytes */
+bool imb_is_a_dds(const unsigned char *mem, size_t UNUSED(size))
{
/* heuristic check to see if mem contains a DDS file */
/* header.fourcc == FOURCC_DDS */
if ((mem[0] != 'D') || (mem[1] != 'D') || (mem[2] != 'S') || (mem[3] != ' ')) {
- return 0;
+ return false;
}
/* header.size == 124 */
if ((mem[4] != 124) || mem[5] || mem[6] || mem[7]) {
- return 0;
+ return false;
}
- return 1;
+ return true;
}
struct ImBuf *imb_load_dds(const unsigned char *mem,
@@ -108,7 +109,7 @@ struct ImBuf *imb_load_dds(const unsigned char *mem,
*/
colorspace_set_default_role(colorspace, IM_MAX_SPACE, COLOR_ROLE_DEFAULT_BYTE);
- if (!imb_is_a_dds(mem)) {
+ if (!imb_is_a_dds(mem, size)) {
return nullptr;
}
diff --git a/source/blender/imbuf/intern/dds/dds_api.h b/source/blender/imbuf/intern/dds/dds_api.h
index ca74cbeaa74..9020529f210 100644
--- a/source/blender/imbuf/intern/dds/dds_api.h
+++ b/source/blender/imbuf/intern/dds/dds_api.h
@@ -26,7 +26,8 @@
extern "C" {
#endif
-int imb_is_a_dds(const unsigned char *mem); /* use only first 32 bytes of mem */
+/* use only first 32 bytes of mem */
+bool imb_is_a_dds(const unsigned char *mem, const size_t size);
bool imb_save_dds(struct ImBuf *ibuf, const char *name, int flags);
struct ImBuf *imb_load_dds(const unsigned char *mem,
size_t size,
diff --git a/source/blender/imbuf/intern/iris.c b/source/blender/imbuf/intern/iris.c
index 6bf2e3ec8d3..c27ac5754c7 100644
--- a/source/blender/imbuf/intern/iris.c
+++ b/source/blender/imbuf/intern/iris.c
@@ -243,7 +243,7 @@ static void test_endian_zbuf(struct ImBuf *ibuf)
/* this one is only def-ed once, strangely... */
#define GSS(x) (((uchar *)(x))[1] << 8 | ((uchar *)(x))[0])
-int imb_is_a_iris(const uchar *mem)
+bool imb_is_a_iris(const uchar *mem, size_t UNUSED(size))
{
return ((GS(mem) == IMAGIC) || (GSS(mem) == IMAGIC));
}
@@ -271,7 +271,7 @@ struct ImBuf *imb_loadiris(const uchar *mem, size_t size, int flags, char colors
return NULL;
}
- if (!imb_is_a_iris(mem)) {
+ if (!imb_is_a_iris(mem, size)) {
return NULL;
}
diff --git a/source/blender/imbuf/intern/jp2.c b/source/blender/imbuf/intern/jp2.c
index f0486852d6f..b964510b8db 100644
--- a/source/blender/imbuf/intern/jp2.c
+++ b/source/blender/imbuf/intern/jp2.c
@@ -80,7 +80,7 @@ static OPJ_CODEC_FORMAT format_from_header(const unsigned char mem[JP2_FILEHEADE
return OPJ_CODEC_UNKNOWN;
}
-int imb_is_a_jp2(const unsigned char *buf)
+bool imb_is_a_jp2(const unsigned char *buf, size_t UNUSED(size))
{
return (check_jp2(buf) || check_j2k(buf));
}
diff --git a/source/blender/imbuf/intern/jpeg.c b/source/blender/imbuf/intern/jpeg.c
index fca24a1baa9..4a937738b52 100644
--- a/source/blender/imbuf/intern/jpeg.c
+++ b/source/blender/imbuf/intern/jpeg.c
@@ -57,7 +57,7 @@ static ImBuf *ibJpegImageFromCinfo(struct jpeg_decompress_struct *cinfo, int fla
static const uchar jpeg_default_quality = 75;
static uchar ibuf_quality;
-int imb_is_a_jpeg(const unsigned char *mem)
+bool imb_is_a_jpeg(const unsigned char *mem, const size_t UNUSED(size))
{
if ((mem[0] == 0xFF) && (mem[1] == 0xD8)) {
return 1;
@@ -429,7 +429,7 @@ ImBuf *imb_load_jpeg(const unsigned char *buffer,
struct my_error_mgr jerr;
ImBuf *ibuf;
- if (!imb_is_a_jpeg(buffer)) {
+ if (!imb_is_a_jpeg(buffer, size)) {
return NULL;
}
diff --git a/source/blender/imbuf/intern/oiio/openimageio_api.cpp b/source/blender/imbuf/intern/oiio/openimageio_api.cpp
index 0b787a7842f..9f27ac96e6d 100644
--- a/source/blender/imbuf/intern/oiio/openimageio_api.cpp
+++ b/source/blender/imbuf/intern/oiio/openimageio_api.cpp
@@ -163,7 +163,7 @@ static ImBuf *imb_oiio_load_image_float(
extern "C" {
-int imb_is_a_photoshop(const unsigned char *mem)
+bool imb_is_a_photoshop(const unsigned char *mem, size_t UNUSED(size))
{
const unsigned char magic[4] = {'8', 'B', 'P', 'S'};
return memcmp(magic, mem, sizeof(magic)) == 0;
diff --git a/source/blender/imbuf/intern/oiio/openimageio_api.h b/source/blender/imbuf/intern/oiio/openimageio_api.h
index 0ac6e560cfa..659050cdb00 100644
--- a/source/blender/imbuf/intern/oiio/openimageio_api.h
+++ b/source/blender/imbuf/intern/oiio/openimageio_api.h
@@ -31,7 +31,7 @@ extern "C" {
struct ImBuf;
-int imb_is_a_photoshop(const unsigned char *mem);
+bool imb_is_a_photoshop(const unsigned char *mem, const size_t size);
int imb_save_photoshop(struct ImBuf *ibuf, const char *name, int flags);
diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp
index 6d4cff4d18d..467454ddb7a 100644
--- a/source/blender/imbuf/intern/openexr/openexr_api.cpp
+++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp
@@ -330,7 +330,7 @@ extern "C" {
* Test presence of OpenEXR file.
* \param mem: pointer to loaded OpenEXR bitstream
*/
-int imb_is_a_openexr(const unsigned char *mem)
+bool imb_is_a_openexr(const unsigned char *mem, const size_t UNUSED(size))
{
return Imf::isImfMagic((const char *)mem);
}
@@ -1905,7 +1905,7 @@ struct ImBuf *imb_load_openexr(const unsigned char *mem,
IMemStream *membuf = nullptr;
MultiPartInputFile *file = nullptr;
- if (imb_is_a_openexr(mem) == 0) {
+ if (imb_is_a_openexr(mem, size) == 0) {
return nullptr;
}
diff --git a/source/blender/imbuf/intern/openexr/openexr_api.h b/source/blender/imbuf/intern/openexr/openexr_api.h
index fcbd9b803b8..940715690a7 100644
--- a/source/blender/imbuf/intern/openexr/openexr_api.h
+++ b/source/blender/imbuf/intern/openexr/openexr_api.h
@@ -32,7 +32,7 @@ extern "C" {
void imb_initopenexr(void);
void imb_exitopenexr(void);
-int imb_is_a_openexr(const unsigned char *mem);
+bool imb_is_a_openexr(const unsigned char *mem, const size_t size);
bool imb_save_openexr(struct ImBuf *ibuf, const char *name, int flags);
diff --git a/source/blender/imbuf/intern/png.c b/source/blender/imbuf/intern/png.c
index 1f90f91be3e..a4ad839c513 100644
--- a/source/blender/imbuf/intern/png.c
+++ b/source/blender/imbuf/intern/png.c
@@ -59,9 +59,9 @@ BLI_INLINE unsigned short UPSAMPLE_8_TO_16(const unsigned char _val)
return (_val << 8) + _val;
}
-int imb_is_a_png(const unsigned char *mem)
+bool imb_is_a_png(const unsigned char *mem, size_t UNUSED(size))
{
- int ret_val = 0;
+ bool ret_val = 0;
#if (PNG_LIBPNG_VER_MAJOR == 1) && (PNG_LIBPNG_VER_MINOR == 2)
/* Older version of libpng doesn't use const pointer to memory. */
@@ -548,7 +548,7 @@ ImBuf *imb_loadpng(const unsigned char *mem, size_t size, int flags, char colors
float *to_float;
unsigned int channels;
- if (imb_is_a_png(mem) == 0) {
+ if (imb_is_a_png(mem, size) == 0) {
return NULL;
}
diff --git a/source/blender/imbuf/intern/radiance_hdr.c b/source/blender/imbuf/intern/radiance_hdr.c
index adeed444c80..d8b032dc5bd 100644
--- a/source/blender/imbuf/intern/radiance_hdr.c
+++ b/source/blender/imbuf/intern/radiance_hdr.c
@@ -197,7 +197,7 @@ static void FLOAT2RGBE(const fCOLOR fcol, RGBE rgbe)
/* ImBuf read */
-int imb_is_a_hdr(const unsigned char *buf)
+bool imb_is_a_hdr(const unsigned char *buf, size_t UNUSED(size))
{
/* NOTE: `#?RADIANCE` is used by other programs such as `ImageMagik`,
* Although there are some files in the wild that only use `#?` (from looking online).
@@ -226,7 +226,7 @@ struct ImBuf *imb_loadhdr(const unsigned char *mem,
const unsigned char *ptr, *mem_eof = mem + size;
char oriY[80], oriX[80];
- if (imb_is_a_hdr(mem)) {
+ if (imb_is_a_hdr(mem, size)) {
colorspace_set_default_role(colorspace, IM_MAX_SPACE, COLOR_ROLE_DEFAULT_FLOAT);
/* find empty line, next line is resolution info */
diff --git a/source/blender/imbuf/intern/targa.c b/source/blender/imbuf/intern/targa.c
index 6d156a637d3..64dbf6deb4b 100644
--- a/source/blender/imbuf/intern/targa.c
+++ b/source/blender/imbuf/intern/targa.c
@@ -361,7 +361,7 @@ bool imb_savetarga(struct ImBuf *ibuf, const char *filepath, int UNUSED(flags))
return ok;
}
-static int checktarga(TARGA *tga, const unsigned char *mem)
+static bool checktarga(TARGA *tga, const unsigned char *mem)
{
tga->numid = mem[0];
tga->maptyp = mem[1];
@@ -378,7 +378,7 @@ static int checktarga(TARGA *tga, const unsigned char *mem)
tga->imgdes = mem[17];
if (tga->maptyp > 1) {
- return 0;
+ return false;
}
switch (tga->imgtyp) {
case 1: /* raw cmap */
@@ -389,27 +389,27 @@ static int checktarga(TARGA *tga, const unsigned char *mem)
case 11: /* b&w */
break;
default:
- return 0;
+ return false;
}
if (tga->mapsize && tga->mapbits > 32) {
- return 0;
+ return false;
}
if (tga->xsize <= 0) {
- return 0;
+ return false;
}
if (tga->ysize <= 0) {
- return 0;
+ return false;
}
if (tga->pixsize > 32) {
- return 0;
+ return false;
}
if (tga->pixsize == 0) {
- return 0;
+ return false;
}
- return 1;
+ return true;
}
-int imb_is_a_targa(const unsigned char *buf)
+bool imb_is_a_targa(const unsigned char *buf, size_t UNUSED(size))
{
TARGA tga;
diff --git a/source/blender/imbuf/intern/tiff.c b/source/blender/imbuf/intern/tiff.c
index aa58eaa125d..69c1c6b596c 100644
--- a/source/blender/imbuf/intern/tiff.c
+++ b/source/blender/imbuf/intern/tiff.c
@@ -316,7 +316,7 @@ static TIFF *imb_tiff_client_open(ImbTIFFMemFile *memFile, const unsigned char *
* hence my manual comparison. - Jonathan Merritt (lancelet) 4th Sept 2005.
*/
#define IMB_TIFF_NCB 4 /* number of comparison bytes used */
-int imb_is_a_tiff(const unsigned char *buf)
+bool imb_is_a_tiff(const unsigned char *buf, size_t UNUSED(size))
{
const char big_endian[IMB_TIFF_NCB] = {0x4d, 0x4d, 0x00, 0x2a};
const char lil_endian[IMB_TIFF_NCB] = {0x49, 0x49, 0x2a, 0x00};
@@ -578,7 +578,7 @@ ImBuf *imb_loadtiff(const unsigned char *mem,
fprintf(stderr, "imb_loadtiff: size < IMB_TIFF_NCB\n");
return NULL;
}
- if (imb_is_a_tiff(mem) == 0) {
+ if (imb_is_a_tiff(mem, size) == 0) {
return NULL;
}
diff --git a/source/blender/imbuf/intern/util.c b/source/blender/imbuf/intern/util.c
index 73d1cadaa69..1741d3f20b7 100644
--- a/source/blender/imbuf/intern/util.c
+++ b/source/blender/imbuf/intern/util.c
@@ -169,7 +169,7 @@ int IMB_ispic_type_from_memory(const unsigned char *mem, const size_t mem_size)
for (const ImFileType *type = IMB_FILE_TYPES; type < IMB_FILE_TYPES_LAST; type++) {
if (type->is_a != NULL) {
- if (type->is_a(buf)) {
+ if (type->is_a(buf, HEADER_SIZE)) {
return type->filetype;
}
}
@@ -200,7 +200,7 @@ bool IMB_ispic_type_matches(const char *filepath, int filetype)
* Keep the check for developers. */
BLI_assert(type->is_a != NULL);
if (type->is_a != NULL) {
- return type->is_a(buf);
+ return type->is_a(buf, HEADER_SIZE);
}
}
}