~ubuntu-branches/ubuntu/hardy/clamav/hardy-backports

« back to all changes in this revision

Viewing changes to libclamav/pdf.c

  • Committer: Bazaar Package Importer
  • Author(s): Scott Kitterman
  • Date: 2010-12-01 11:26:02 UTC
  • mfrom: (0.5.36 natty)
  • Revision ID: james.westby@ubuntu.com-20101201112602-f408toqx14w4duw7
Tags: 0.96.4+dfsg-1ubuntu1~hardy1
* Source backport for Hardy:
  - Build without llvm support on lpia to fix FTBFS (not a regression as
    llvm has never built on hardy lpia)
  - Drop -T -W from apparmor_parser calls in clamav-daemon and freshclam
    postinsts since it is not supported in Hardy's apparmor
  - Drop deny rule in freshclam apparmor profile since deny is not
    supported in Hardy's apparmor
  - Drop dh_lintian from debian/rules and adjust version of debhelper
    build-dep
  - Drop build-dep and libclamav-dev depends on non-existent libtommath-dev
  - Changed Section to 'utils' for clamav-dbg package
  - Drop versioning of lsb-base depends
  - Revert lsb status changes from maintainer scripts
  - Ignore test suite errors on hppa
  - Build-depend on libltdl3-dev instead of libltdl-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
899
899
    dict_length = q3 - dict;
900
900
 
901
901
    /*  process pdf names */
902
 
    for (q = dict;dict_length;) {
 
902
    for (q = dict;dict_length > 0;) {
903
903
        int escapes = 0;
904
904
        q2 = memchr(q, '/', dict_length);
905
905
        if (!q2)
907
907
        dict_length -= q2 - q;
908
908
        q = q2;
909
909
        /* normalize PDF names */
910
 
        for (i = 0;dict_length && (i < sizeof(pdfname)-1); i++) {
 
910
        for (i = 0;dict_length > 0 && (i < sizeof(pdfname)-1); i++) {
911
911
            q++;
912
912
            dict_length--;
913
913
            if (*q == '#') {
914
 
                cli_hex2str_to(q+1, pdfname+i, 2);
 
914
                if (cli_hex2str_to(q+1, pdfname+i, 2) == -1)
 
915
                    break;
915
916
                q += 2;
916
917
                dict_length -= 2;
917
918
                escapes = 1;
918
919
                continue;
919
920
            }
920
921
            if (*q == ' ' || *q == '\t' || *q == '\r' || *q == '\n' ||
921
 
                *q == '/' || *q == '>' || *q == ']' || *q == '[' || *q == '<')
 
922
                *q == '/' || *q == '>' || *q == ']' || *q == '[' || *q == '<'
 
923
                || *q == '(')
922
924
                break;
923
925
            pdfname[i] = *q;
924
926
        }
929
931
            pdfobj_flag(pdf, obj, LINEARIZED_PDF);
930
932
            objstate = STATE_NONE;
931
933
        }
932
 
        if (objstate == STATE_JAVASCRIPT ||
933
 
            objstate == STATE_OPENACTION) {
 
934
        if (dict_length > 0 && (objstate == STATE_JAVASCRIPT ||
 
935
            objstate == STATE_OPENACTION)) {
934
936
            if (objstate == STATE_OPENACTION)
935
937
                pdfobj_flag(pdf, obj, HAS_OPENACTION);
936
938
            q2 = pdf_nextobject(q, dict_length);
941
943
                if (q2 && isdigit(*q2)) {
942
944
                    objid |= atoi(q2) & 0xff;
943
945
                    q2 = pdf_nextobject(q2, dict_length);
944
 
                    if (*q2 == 'R') {
 
946
                    if (q2 && *q2 == 'R') {
945
947
                        struct pdf_obj *obj2;
946
948
                        cli_dbgmsg("cli_pdf: found %s stored in indirect object %u %u\n",
947
949
                                   pdfname,
1024
1026
    offset += pdfver - start;
1025
1027
 
1026
1028
    /* find trailer and xref, don't fail if not found */
1027
 
    map_off = map->len - 2048;
 
1029
    map_off = (off_t)map->len - 2048;
1028
1030
    if (map_off < 0)
1029
1031
        map_off = 0;
1030
1032
    bytesleft = map->len - map_off;
1043
1045
        cli_dbgmsg("cli_pdf: %%%%EOF not found\n");
1044
1046
    } else {
1045
1047
        const char *t;
1046
 
        size = q - eofmap + map_off;
 
1048
        /*size = q - eofmap + map_off;*/
 
1049
        q -= 9;
1047
1050
        for (;q > eofmap;q--) {
1048
1051
            if (memcmp(q, "startxref", 9) == 0)
1049
1052
                break;