Fix/validates length of min max length

https://www.openproject.org/work_packages/14632
I'm not sure if this is necessary, but you might want to comment on where the magic numbers come from.

`8*size_in_bytes` -> number of bits that can be stored
`2**number_of_bits - 1` -> max value that can be stored if the type is unsigned
Things are signes, thus the max. value is only half the size.