Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6740544

mismatch of signed, unsigned values causes mmap failure

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 6
    • core-libs
    • None

      In zip_util.h, macros are defined to access header fields, e.g.
      #define LG(b, n) (SH(b, n) | (SH(b, n+2) << 16))
      ...
      #define ENDSIZ(b) LG(b, 12) /* central directory size */

      These are used in zip_util.c, e.g.
          cenlen = ENDSIZ(endbuf);
          if (cenlen > endpos)
      ZIP_FORMAT_ERROR("invalid END header (bad central directory size)");

      cenlen is declared as a jlong, which is signed. If the value returned from ENDSIZ has the high order bit set, cenlen is negative, and definitely less than endpos. The value of cenlen is used (indirectly) in a call to mmap, which results in

      mmap failed for CEN and END part of zip file

            sherman Xueming Shen
            bristor Dave Bristor (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: