Description: Fix CVE-2017-9054
Origin: upstream, https://sourceforge.net/p/libdwarf/code/ci/cc37d6917011733d776ae228af4e5d6abe9613c1/
Bug: https://www.prevanders.net/dwarfbug.html#DW201703-002
Bug-Debian: https://bugs.debian.org/864064
Last-Update: 2017-07-08
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/libdwarf/dwarf_leb.c
+++ b/libdwarf/dwarf_leb.c
@@ -301,11 +301,11 @@
             break;
         }
         ++leb128;
-        byte = *leb128;
-        byte_length++;
         if (leb128 >= endptr) {
             return DW_DLV_ERROR;
         }
+        byte = *leb128;
+        byte_length++;
         if (byte_length > BYTESLEBMAX) {
             /*  Erroneous input. */
             if (leb128_length) {
