~ubuntu-branches/ubuntu/utopic/clamav/utopic-security

« back to all changes in this revision

Viewing changes to libclamav/pe_icons.c

  • Committer: Package Import Robot
  • Author(s): Scott Kitterman
  • Date: 2014-02-01 11:06:17 UTC
  • mfrom: (0.35.37 sid)
  • Revision ID: package-import@ubuntu.com-20140201110617-33h2xxk09dep0ui4
Tags: 0.98.1+dfsg-1ubuntu1
* Merge from Debian unstable.  Remaining changes:
  - Drop build-dep on electric-fence (in Universe)
  - Add apparmor profiles for clamd and freshclam along with maintainer
    script changes
  - Add autopkgtest

Show diffs side-by-side

added added

removed removed

Lines of Context:
90
90
    findres(14, 0xffffffff, resdir_rva, map, exe_sections, nsections, hdr_size, groupicon_cb, &gicons);
91
91
        
92
92
    for(curicon=0; curicon<gicons.cnt; curicon++) {
93
 
        uint8_t *grp = fmap_need_off_once(map, cli_rawaddr(gicons.rvas[curicon], exe_sections, nsections, &err, map->len, hdr_size), 16);
 
93
        const uint8_t *grp = fmap_need_off_once(map, cli_rawaddr(gicons.rvas[curicon], exe_sections, nsections, &err, map->len, hdr_size), 16);
94
94
        if(grp && !err) {
95
95
            uint32_t gsz = cli_readint32(grp + 4);
96
96
            if(gsz>6) {
776
776
    unsigned int edge_avg[6], edge_x[6]={0,0,0,0,0,0}, edge_y[6]={0,0,0,0,0,0}, noedge_avg[6], noedge_x[6]={0,0,0,0,0,0}, noedge_y[6]={0,0,0,0,0,0};
777
777
    double *sobel;
778
778
 
779
 
    if(!(tmp = cli_malloc(side*side*4*2)))
780
 
        return CL_EMEM;
 
779
    if(!(tmp = cli_malloc(side*side*4*2))) {
 
780
        cli_errmsg("getmetrics: Unable to allocate memory for tmp %u\n", (side*side*4*2));
 
781
        return CL_EMEM;
 
782
    }
781
783
 
782
784
    memset(res, 0, sizeof(*res));
783
785
 
939
941
#ifdef USE_FLOATS
940
942
    sobel = cli_malloc(side * side * sizeof(double));
941
943
    if(!sobel) {
 
944
        cli_errmsg("getmetrics: Unable to allocate memory for edge detection %u\n", (side * side * sizeof(double)));
942
945
        free(tmp);
943
946
        return CL_EMEM;
944
947
    }
1194
1197
        unsigned int important;
1195
1198
    } bmphdr;
1196
1199
    struct icomtr metrics;
1197
 
    unsigned char *rawimage;
 
1200
    const unsigned char *rawimage;
1198
1201
    const char *tempd;
1199
 
    uint32_t *palette = NULL, *imagedata;
 
1202
    const uint32_t *palette = NULL;
 
1203
    uint32_t *imagedata;
1200
1204
    unsigned int scanlinesz, andlinesz;
1201
1205
    unsigned int width, height, depth, x, y;
1202
1206
    unsigned int err, scalemode = 2, enginesize;
1212
1216
    icoff = cli_rawaddr(rva, exe_sections, nsections, &err, map->len, hdr_size);
1213
1217
 
1214
1218
    /* read the bitmap header */
1215
 
    if(err || !(imagedata = fmap_need_off_once(map, icoff, 4))) {
 
1219
    if(err || !(rawimage = fmap_need_off_once(map, icoff, 4))) {
1216
1220
        cli_dbgmsg("parseicon: offset to icon is out of file\n");
1217
1221
        return CL_SUCCESS;
1218
1222
    }
1219
1223
 
1220
 
    rva = cli_readint32(imagedata);
 
1224
    rva = cli_readint32(rawimage);
1221
1225
    icoff = cli_rawaddr(rva, exe_sections, nsections, &err, map->len, hdr_size);
1222
1226
    if(err || fmap_readn(map, &bmphdr, icoff, sizeof(bmphdr)) != sizeof(bmphdr)) {
1223
1227
        cli_dbgmsg("parseicon: bmp header is out of file\n");