summaryrefslogtreecommitdiffstats
path: root/src/file_ico.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2009-01-22 19:11:04 +0100
committerChristophe Grenier <grenier@cgsecurity.org>2009-01-22 19:11:04 +0100
commit939f83042f4e9aa4e54dc713ae295b9ff7bc60d1 (patch)
tree30bb86c9d90eaceb6c03dab0328d8ce799b29524 /src/file_ico.c
parent33499cc6201df2da9ec2dd5dfd5e8671f1e36436 (diff)
PhotoRec: an icon should be square and 16 pixels minimum
Diffstat (limited to 'src/file_ico.c')
-rw-r--r--src/file_ico.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/file_ico.c b/src/file_ico.c
index 6baaaa8..5e4d885 100644
--- a/src/file_ico.c
+++ b/src/file_ico.c
@@ -43,7 +43,7 @@ static int header_check_ico(const unsigned char *buffer, const unsigned int buff
const file_hint_t file_hint_ico= {
.extension="ico",
- .description="Windows Icone",
+ .description="Windows Icon",
.min_header_distance=0,
.max_filesize=PHOTOREC_MAX_FILE_SIZE,
.recover=1,
@@ -85,10 +85,13 @@ static int header_check_ico(const unsigned char *buffer, const unsigned int buff
{
const struct ico_header *ico=(const struct ico_header*)buffer;
const struct ico_directory *ico_dir=(const struct ico_directory*)(ico+1);
- /* Recover icon with a single image */
+ /* Recover square icon with a single image */
if(le16(ico->reserved)==0 && le16(ico->type)==1 && le16(ico->count)==1 &&
(ico_dir->reserved==0 || ico_dir->reserved==255) &&
- (ico_dir->color_planes==0 || ico_dir->color_planes==1)
+ (ico_dir->color_planes==0 || ico_dir->color_planes==1) &&
+ ico_dir->width==ico_dir->heigth &&
+ ico_dir->width>=16
+
)
{
reset_file_recovery(file_recovery_new);
@@ -96,6 +99,7 @@ static int header_check_ico(const unsigned char *buffer, const unsigned int buff
file_recovery_new->calculated_file_size=le32(ico_dir->bitmap_size) + le32(ico_dir->bitmap_offset);
file_recovery_new->data_check=&data_check_size;
file_recovery_new->file_check=&file_check_size;
+ return 1;
}
- return 1;
+ return 0;
}