<html>
    <head>
      <base href="https://bugs.freedesktop.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - invalid input will cause out of bounds heap read in function Hints::getPageObjectNum"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=91200">91200</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>invalid input will cause out of bounds heap read in function Hints::getPageObjectNum
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>poppler
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Other
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>general
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>poppler-bugs@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>hanno@hboeck.de
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=116894" name="attach_116894" title="sample input causing out of bounds access">attachment 116894</a> <a href="attachment.cgi?id=116894&action=edit" title="sample input causing out of bounds access">[details]</a></span>
sample input causing out of bounds access

The attached file will cause an invalid read access in poppler. Can be tested
with either address sanitizer or valgrind.

This is the address sanitizer output with pdftoppm:
==31074==ERROR: AddressSanitizer: heap-buffer-overflow on address
0x60200000fc74 at pc 0x0000008aaaaf bp 0x7fffdd7b1f00 sp 0x7fffdd7b1ef8
READ of size 4 at 0x60200000fc74 thread T0
    #0 0x8aaaae in Hints::getPageObjectNum(int)
/f/poppler-0.33.0/poppler/Hints.cc:449:12
    #1 0x68807d in PDFDoc::parsePage(int)
/f/poppler-0.33.0/poppler/PDFDoc.cc:1888:17
    #2 0x673518 in PDFDoc::getPage(int)
/f/poppler-0.33.0/poppler/PDFDoc.cc:1929:27
    #3 0x522284 in PDFDoc::getPageMediaWidth(int)
/f/poppler-0.33.0/utils/../poppler/PDFDoc.h:126:14
    #4 0x522284 in main /f/poppler-0.33.0/utils/pdftoppm.cc:492
    #5 0x7f9403dbdf9f in __libc_start_main
/var/tmp/portage/sys-libs/glibc-2.20-r2/work/glibc-2.20/csu/libc-start.c:289
    #6 0x47a0cb in _start (/mnt/ram/poppler/pdftoppm+0x47a0cb)

0x60200000fc74 is located 0 bytes to the right of 4-byte region
[0x60200000fc70,0x60200000fc74)
allocated by thread T0 here:
    #0 0x501092 in __interceptor_malloc (/mnt/ram/poppler/pdftoppm+0x501092)
    #1 0x708812 in gmalloc(unsigned long, bool)
/f/poppler-0.33.0/goo/gmem.cc:110:13
    #2 0x708812 in gmallocn(int, int, bool) /f/poppler-0.33.0/goo/gmem.cc:192
    #3 0x708812 in gmallocn_checkoverflow /f/poppler-0.33.0/goo/gmem.cc:200

SUMMARY: AddressSanitizer: heap-buffer-overflow
/f/poppler-0.33.0/poppler/Hints.cc:449 Hints::getPageObjectNum(int)
Shadow bytes around the buggy address:
  0x0c047fff9f30: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff9f40: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff9f50: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff9f60: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff9f70: fa fa fa fa fa fa fa fa fa fa 00 fa fa fa 04 fa
=>0x0c047fff9f80: fa fa 00 fa fa fa 04 fa fa fa 04 fa fa fa[04]fa
  0x0c047fff9f90: fa fa 04 fa fa fa 00 fa fa fa 04 fa fa fa 00 00
  0x0c047fff9fa0: fa fa 00 00 fa fa 01 fa fa fa 04 fa fa fa fd fa
  0x0c047fff9fb0: fa fa fd fa fa fa fd fa fa fa fd fa fa fa fd fa
  0x0c047fff9fc0: fa fa 05 fa fa fa fd fa fa fa fd fa fa fa fd fa
  0x0c047fff9fd0: fa fa fd fa fa fa fd fa fa fa 05 fa fa fa fd fa
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07 
  Heap left redzone:       fa
  Heap right redzone:      fb
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack partial redzone:   f4
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
==31074==ABORTING</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>