Branch: Tag:

2015-12-15

2015-12-15 11:06:28 by Martin Karlgren <marty@roxen.com>

EXIF: Avoid trying to read a negative amount of ascii characters.

Some EXIF ascii tags apparently have a zero tag_count value.

995:    break;       case 2: // ASCII -  tags[tag_name]=String.trim_whites(file->read(tag_count-1))-"\0"; +  tags[tag_name]=String.trim_whites(file->read(max(tag_count-1, 0)))-"\0";    break;       case 3: // SHORT
1003:    {    if(tag_count>0xffff) return ([]); // Impossible amount of tags.    array a=allocate(tag_count); +     for(int i=0; i<tag_count; i++)    a[i]=file->read_short();