File: null_iterator_deref.qhelp

package info (click to toggle)
exiv2 0.28.7%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 109,216 kB
  • sloc: cpp: 77,667; python: 9,619; javascript: 237; makefile: 193; sh: 172; ansic: 51; sed: 16
file content (23 lines) | stat: -rw-r--r-- 877 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<!DOCTYPE qhelp SYSTEM "qhelp.dtd">
<qhelp>
    <overview>
        <p>
        A C++ iterator is a lot like a C pointer: if you dereference it without
        first checking that it's valid then it can cause a crash.
        </p>
    </overview>
    <recommendation>
        <p>
        Always check that the iterator is valid before derefencing it.
        </p>
    </recommendation>
    <example>
        <p>
        <a href="https://github.com/Exiv2/exiv2/issues/1763">Issue 1763</a> was caused by
        <a href="https://github.com/Exiv2/exiv2/blob/9b3ed3f9564b4ea51b43c78671435bde6b862e08/src/canonmn_int.cpp#L2755">this
        dereference</a> of the iterator <tt>pos</tt>.
        The bug was <a href="https://github.com/Exiv2/exiv2/pull/1767">fixed</a> by not dereferencing
        <tt>pos</tt> if <tt>pos == metadata->end()</tt>.
        </p>
    </example>
</qhelp>