buffer-overflow-in-real-program

  1. out-of-bound-write
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    cpTags(TIFF* in, TIFF* out)
    {
    struct cpTag *p;
    for (p = tags; p < &tags[NTAGS]; p++)
    - cpTag(in, out, p->tag, p->count, p->type);
    + {
    + if( p->tag == TIFFTAG_GROUP3OPTIONS )
    + {
    + uint16 compression;
    + if( !TIFFGetField(in, TIFFTAG_COMPRESSION, &compression) ||
    + compression != COMPRESSION_CCITTFAX3 )
    + continue;
    + }
    + if( p->tag == TIFFTAG_GROUP4OPTIONS )
    + {
    + uint16 compression;
    + if( !TIFFGetField(in, TIFFTAG_COMPRESSION, &compression) ||
    + compression != COMPRESSION_CCITTFAX4 )
    + continue;
    + }
    + cpTag(in, out, p->tag, p->count, p->type);
    + }
    }