Add basic range check to prevent overflow of uints
Signed-off-by: Chris Rizzitello <rizzitello@kde.org>