def _testLengthBoundaryValidity(dataLength, tableDirectory):
    """
    >>> test = [
    ...     dict(tag="test", offset=44, length=1)
    ... ]
    >>> bool(_testLengthBoundaryValidity(45, test))
    False
    >>> test = [
    ...     dict(tag="test", offset=44, length=2)
    ... ]
    >>> bool(_testLengthBoundaryValidity(45, test))
    True
    """
    errors = []
    entries = [(entry["offset"], entry) for entry in tableDirectory]
    for o, entry in sorted(entries):
        offset = entry["offset"]
        length = entry["length"]
        tag = entry["tag"]
        end = offset + length
        if end > dataLength:
            errors.append("The length of the %s table is not valid." % tag)
    return errors