Skip to content

Commit 2ca8903

Browse files
ragusaaval-ms
authored andcommitted
Add support for UDF files
Add support for specifically for Beginning Extended Area Descriptor (BEA01) type of UDF files.
1 parent e4ac4b6 commit 2ca8903

9 files changed

Lines changed: 1437 additions & 2 deletions

File tree

libclamav/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,8 @@ set(LIBCLAMAV_SOURCES
395395
tiff.c tiff.h
396396
# GIF image format checker
397397
gif.c gif.h
398+
# UDF partition
399+
udf.c udf.h
398400
)
399401

400402
if(ENABLE_SHARED_LIB)

libclamav/dconf.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ static struct dconf_module modules[] = {
106106
{"ARCHIVE", "GPT", ARCH_CONF_GPT, 1},
107107
{"ARCHIVE", "APM", ARCH_CONF_APM, 1},
108108
{"ARCHIVE", "EGG", ARCH_CONF_EGG, 1},
109+
{"ARCHIVE", "UDF", ARCH_CONF_UDF, 1},
109110

110111
{"DOCUMENT", "HTML", DOC_CONF_HTML, 1},
111112
{"DOCUMENT", "RTF", DOC_CONF_RTF, 1},

libclamav/dconf.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ struct cli_dconf {
9696
#define ARCH_CONF_GPT 0x1000000
9797
#define ARCH_CONF_APM 0x2000000
9898
#define ARCH_CONF_EGG 0x4000000
99+
#define ARCH_CONF_UDF 0x8000000
99100

100101
/* Document flags */
101102
#define DOC_CONF_HTML 0x1

libclamav/filetypes.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ static const struct ftmap_s {
137137
{ "CL_TYPE_LNK", CL_TYPE_LNK },
138138
{ "CL_TYPE_EGG", CL_TYPE_EGG },
139139
{ "CL_TYPE_EGGSFX", CL_TYPE_EGGSFX },
140+
{ "CL_TYPE_UDF", CL_TYPE_UDF },
140141
{ NULL, CL_TYPE_IGNORED }
141142
};
142143
// clang-format on

libclamav/filetypes.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ typedef enum cli_file {
122122
CL_TYPE_HWPOLE2,
123123
CL_TYPE_MHTML,
124124
CL_TYPE_LNK,
125-
125+
CL_TYPE_UDF,
126126
CL_TYPE_OTHER, /* on-the-fly, used for target 14 (OTHER) */
127127
CL_TYPE_IGNORED /* please don't add anything below */
128128
} cli_file_t;

libclamav/filetypes_int.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ static const char *ftypes_int[] = {
149149
"0:0:4d53434600000000:MS CAB:CL_TYPE_ANY:CL_TYPE_MSCAB",
150150
"1:*:4d53434600000000:CAB-SFX:CL_TYPE_ANY:CL_TYPE_CABSFX",
151151
"1:*:014344303031{2043-2443}4344303031:ISO9660:CL_TYPE_ANY:CL_TYPE_ISO9660:71",
152+
"1:0,32768:004245413031:UDF:CL_TYPE_ANY:CL_TYPE_UDF:180",
152153
"0:0:5b616c69617365735d:TAR-POSIX-CVE-2012-1419:CL_TYPE_ANY:CL_TYPE_POSIX_TAR",
153154
"1:8,12:19040010:SIS:CL_TYPE_ANY:CL_TYPE_SIS",
154155
"1:0,1024:44656c6976657265642d546f3a{-256}52656365697665643a:Mail file:CL_TYPE_ANY:CL_TYPE_MAIL",

libclamav/scanners.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@
100100
#include "gif.h"
101101
#include "png.h"
102102
#include "iso9660.h"
103+
#include "udf.h"
103104
#include "dmg.h"
104105
#include "xar.h"
105106
#include "hfsplus.h"
@@ -3490,12 +3491,24 @@ static cl_error_t scanraw(cli_ctx *ctx, cli_file_t type, uint8_t typercg, cli_fi
34903491
// Reassign type of current layer based on what we discovered
34913492
cli_recursion_stack_change_type(ctx, fpt->type);
34923493

3493-
cli_dbgmsg("DMG signature found at %u\n", (unsigned int)fpt->offset);
3494+
cli_dbgmsg("ISO signature found at %u\n", (unsigned int)fpt->offset);
34943495
nret = cli_scaniso(ctx, fpt->offset);
34953496
}
34963497
}
34973498
break;
34983499

3500+
case CL_TYPE_UDF:
3501+
if (SCAN_PARSE_ARCHIVE && (DCONF_ARCH & ARCH_CONF_UDF)) {
3502+
{
3503+
// Reassign type of current layer based on what we discovered
3504+
cli_recursion_stack_change_type(ctx, fpt->type);
3505+
3506+
cli_dbgmsg("UDF signature found at %u\n", (unsigned int)fpt->offset);
3507+
nret = cli_scanudf(ctx, fpt->offset);
3508+
}
3509+
}
3510+
break;
3511+
34993512
case CL_TYPE_MBR:
35003513
if (SCAN_PARSE_ARCHIVE) {
35013514
// TODO: determine all types that GPT or MBR may start with

0 commit comments

Comments
 (0)