Protect against negative values to memmove (#1951480) Cherry-picked from upstream PR #78 Resolves: rhbz#2051621