<p dir="auto">Posted first on <a href="http://stackoverflow.com/questions/35999301/segmentation-fault-on-reading-tif-file-with-python-opencv" rel="nofollow">stackoverflow</a>, but no response as of yet.</p>
<p dir="auto">Any steps I can do to debug further would be appreciated.</p>
<h2 dir="auto"></h2>
<p dir="auto">Environment:</p>
<ul dir="auto">
<li>centos 6.7</li>
<li>opencv 2.4.12</li>
<li>python 2.7</li>
<li>GNU libc 2.12</li>
<li>gcc version 4.4.7 20120313 (Red Hat 4.4.7-16)</li>
</ul>
<p dir="auto">uname output:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Linux xxxx 2.6.32-573.18.1.el6.x86_64 #1 SMP xxx x86_64 x86_64 x86_64 GNU/Linux"><pre class="notranslate"><code class="notranslate">Linux xxxx 2.6.32-573.18.1.el6.x86_64 #1 SMP xxx x86_64 x86_64 x86_64 GNU/Linux
</code></pre></div>
<p dir="auto">Clean download of 2.4.12 release and compiles fine with the following commands:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="export PYTHON_EXECUTABLE=/usr/bin/python2.7
export PYTHON_INCLUDE_PATH=/usr/include/python2.7/
export PYTHON_LIBRARY=/usr/lib64/libpython2.7.so
export PYTHON_NUMPY_INCLUDE_DIR=/home/centos/.local/lib/python2.7/site-packages/numpy/core/include/numpy
export PYTHON_PACKAGES_PATH=/home/centos/.local/lib/python2.7/site-packages
cmake  \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_INSTALL_PREFIX=/usr/local \
-DBUILD_WITH_DEBUG_INFO=ON \
-DPYTHON_EXECUTABLE=$PYTHON_EXECUTABLE  \
-DPYTHON_INCLUDE_PATH=$PYTHON_INCLUDE_PATH \
-DPYTHON_LIBRARY=$PYTHON_LIBRARY \
-DPYTHON_NUMPY_INCLUDE_DIR=$PYTHON_NUMPY_INCLUDE_DIR \
-DPYTHON_PACKAGES_PATH=$PYTHON_PACKAGES_PATH \
-DINSTALL_C_EXAMPLES=OFF \
-DINSTALL_PYTHON_EXAMPLES=OFF \
-DBUILD_EXAMPLES=OFF \
-DWITH_FFMPEG=OFF .."><pre class="notranslate"><code class="notranslate">export PYTHON_EXECUTABLE=/usr/bin/python2.7
export PYTHON_INCLUDE_PATH=/usr/include/python2.7/
export PYTHON_LIBRARY=/usr/lib64/libpython2.7.so
export PYTHON_NUMPY_INCLUDE_DIR=/home/centos/.local/lib/python2.7/site-packages/numpy/core/include/numpy
export PYTHON_PACKAGES_PATH=/home/centos/.local/lib/python2.7/site-packages
cmake  \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_INSTALL_PREFIX=/usr/local \
-DBUILD_WITH_DEBUG_INFO=ON \
-DPYTHON_EXECUTABLE=$PYTHON_EXECUTABLE  \
-DPYTHON_INCLUDE_PATH=$PYTHON_INCLUDE_PATH \
-DPYTHON_LIBRARY=$PYTHON_LIBRARY \
-DPYTHON_NUMPY_INCLUDE_DIR=$PYTHON_NUMPY_INCLUDE_DIR \
-DPYTHON_PACKAGES_PATH=$PYTHON_PACKAGES_PATH \
-DINSTALL_C_EXAMPLES=OFF \
-DINSTALL_PYTHON_EXAMPLES=OFF \
-DBUILD_EXAMPLES=OFF \
-DWITH_FFMPEG=OFF ..
</code></pre></div>
<p dir="auto">Output snippet from running make</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="--   Media I/O: 
--     ZLib:                        /usr/lib64/libz.so (ver 1.2.3)
--     JPEG:                        /usr/lib64/libjpeg.so (ver )
--     PNG:                         /usr/lib64/libpng.so (ver 1.2.49)
--     TIFF:                        /usr/lib64/libtiff.so (ver 42 - 3.9.4)
--     JPEG 2000:                   /usr/lib64/libjasper.so (ver 1.900.1)
--     OpenEXR:                     /usr/lib64/libImath.so /usr/lib64/libIlmImf.so /usr/lib64/libIex.so /usr/lib64/libHalf.so /usr/lib64/libIlmThread.so (ver 1.6.1)
-- "><pre class="notranslate"><code class="notranslate">--   Media I/O: 
--     ZLib:                        /usr/lib64/libz.so (ver 1.2.3)
--     JPEG:                        /usr/lib64/libjpeg.so (ver )
--     PNG:                         /usr/lib64/libpng.so (ver 1.2.49)
--     TIFF:                        /usr/lib64/libtiff.so (ver 42 - 3.9.4)
--     JPEG 2000:                   /usr/lib64/libjasper.so (ver 1.900.1)
--     OpenEXR:                     /usr/lib64/libImath.so /usr/lib64/libIlmImf.so /usr/lib64/libIex.so /usr/lib64/libHalf.so /usr/lib64/libIlmThread.so (ver 1.6.1)
-- 
</code></pre></div>
<p dir="auto">However. This runs fine:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&gt;$ python2.7 -c &quot;import cv2; cv2.imread('test.png')&quot;"><pre class="notranslate"><code class="notranslate">&gt;$ python2.7 -c "import cv2; cv2.imread('test.png')"
</code></pre></div>
<p dir="auto">But this does not:</p>
<blockquote>
<p dir="auto">$ python2.7 -c "import cv2; cv2.imread('test.tif')"</p>
</blockquote>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="OpenCV Error: Assertion failed (udata &lt; (uchar*)ptr &amp;&amp; ((uchar*)ptr -
udata) &lt;= (ptrdiff_t)(sizeof(void*)+16)) in fastFree, file
/fleuron-data/opencv-2.4.12/modules/core/src/alloc.cpp, line 78
terminate called after throwing an instance of 'cv::Exception'
  what():  /fleuron-data/opencv-2.4.12/modules/core/src/alloc.cpp:78:
error: (-215) udata &lt; (uchar*)ptr &amp;&amp; ((uchar*)ptr - udata) &lt;=
(ptrdiff_t)(sizeof(void*)+16) in function fastFree

Aborted"><pre class="notranslate"><code class="notranslate">OpenCV Error: Assertion failed (udata &lt; (uchar*)ptr &amp;&amp; ((uchar*)ptr -
udata) &lt;= (ptrdiff_t)(sizeof(void*)+16)) in fastFree, file
/fleuron-data/opencv-2.4.12/modules/core/src/alloc.cpp, line 78
terminate called after throwing an instance of 'cv::Exception'
  what():  /fleuron-data/opencv-2.4.12/modules/core/src/alloc.cpp:78:
error: (-215) udata &lt; (uchar*)ptr &amp;&amp; ((uchar*)ptr - udata) &lt;=
(ptrdiff_t)(sizeof(void*)+16) in function fastFree

Aborted
</code></pre></div>
<p dir="auto">And has me lost..</p>
<p dir="auto">Can you please help me understand why I can't get imread to open simple bitonal files like this one?<br>
<a href="https://app.box.com/s/y2h71ydjb7uim1um1gwqjvsuqz2cpmf2" rel="nofollow">https://app.box.com/s/y2h71ydjb7uim1um1gwqjvsuqz2cpmf2</a></p>
<p dir="auto">This is an example of what I get. It worked in 3.0 rc but with 3.0.0 it no longer works.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Unhandled exception at 0x00007FF992BB9A1D (opencv_world300d.dll) in OpenCv_FastHough.exe: 0xC0000005: Access violation reading location 0xFFFFFFFFFFFFFFFF."><pre class="notranslate"><code class="notranslate">Unhandled exception at 0x00007FF992BB9A1D (opencv_world300d.dll) in OpenCv_FastHough.exe: 0xC0000005: Access violation reading location 0xFFFFFFFFFFFFFFFF.
</code></pre></div>