<ul dir="auto">
<li>OpenCV =&gt; 3.2</li>
<li>Operating System / Platform =&gt; Fedora 25</li>
<li>Compiler =&gt; gcc 6.3.1</li>
</ul>
<h5 dir="auto">Detailed description</h5>
<p dir="auto">Undefined behavior in <code class="notranslate">cv::rectangle()</code> when two identical points passed.</p>
<h5 dir="auto">Steps to reproduce</h5>
<p dir="auto">Try running the following:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="cv::rectangle(im, cv::Point(1000, 1000), cv::Point(1000, 1000), 255, CV_FILLED);"><pre class="notranslate"><code class="notranslate">cv::rectangle(im, cv::Point(1000, 1000), cv::Point(1000, 1000), 255, CV_FILLED);
</code></pre></div>
<p dir="auto">in <code class="notranslate">valgrind</code>. The output is</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="==4102== Conditional jump or move depends on uninitialised value(s)
==4102==    at 0xBFF483F: cv::FillConvexPoly(cv::Mat&amp;, cv::Point_&lt;long&gt; const*, int, void const*, int, int) (in /usr/local/lib/libopencv_imgproc.so
.3.2.0)
==4102==    by 0xBFFA096: cv::rectangle(cv::_InputOutputArray const&amp;, cv::Point_&lt;int&gt;, cv::Point_&lt;int&gt;, cv::Scalar_&lt;double&gt; const&amp;, int, int, int) 
(in /usr/local/lib/libopencv_imgproc.so.3.2.0)"><pre class="notranslate"><code class="notranslate">==4102== Conditional jump or move depends on uninitialised value(s)
==4102==    at 0xBFF483F: cv::FillConvexPoly(cv::Mat&amp;, cv::Point_&lt;long&gt; const*, int, void const*, int, int) (in /usr/local/lib/libopencv_imgproc.so
.3.2.0)
==4102==    by 0xBFFA096: cv::rectangle(cv::_InputOutputArray const&amp;, cv::Point_&lt;int&gt;, cv::Point_&lt;int&gt;, cv::Scalar_&lt;double&gt; const&amp;, int, int, int) 
(in /usr/local/lib/libopencv_imgproc.so.3.2.0)
</code></pre></div>
<p dir="auto">As a result of this I saw two different resultant images on two different computers. If two identical points are not supported then I think an exception should be thrown.</p>
<h5 dir="auto">System information (version)</h5>

<ul dir="auto">
<li>OpenCV =&gt; ❔</li>
<li>Operating System / Platform =&gt; <g-emoji class="g-emoji" alias="grey_question" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/2754.png">❔</g-emoji></li>
<li>Compiler =&gt; ❔</li>
</ul>
<h5 dir="auto">Detailed description</h5>

<h5 dir="auto">Steps to reproduce</h5>