Commit c2c60557 authored by Marek Chalupa's avatar Marek Chalupa
Browse files

symexe mem: fix a check for uninit bytes

We must substract 1.
parent 62d66147
Loading
Loading
Loading
Loading
+4 −4
Original line number Original line Diff line number Diff line
@@ -55,10 +55,10 @@ def read_bytes(values, offval, size, bts, zeroed):
        # FIXME hack
        # FIXME hack
        val._type = Bytes(val.bytewidth())
        val._type = Bytes(val.bytewidth())
    else:
    else:
        if offval + bts >= len(values):
        if offval + bts > len(values):
            return None, MemError(MemError.UNINIT_READ,
            return None, MemError(MemError.UNINIT_READ,
                                  "Read of {bts} bytes on offset {offval} "
                                  f"Read of {bts} bytes on offset {offval} "
                                  "from object with {len(values)} initialized "
                                  f"from object with {len(values)} initialized "
                                   "values.")
                                   "values.")
        if not all(values[i] for i in range(offval, offval + bts)):
        if not all(values[i] for i in range(offval, offval + bts)):
            return None, MemError(MemError.UNINIT_READ, "Read of uninitialized byte")
            return None, MemError(MemError.UNINIT_READ, "Read of uninitialized byte")