add some checks to prevent overflow
add some checks to prevent overflow

Signed-off-by: Vasiliy Tolstov <c36af997645181f727020b1671b7c66b7a9c7a34@selfip.ru>
Signed-off-by: Michal Privoznik <83d82aaba2eed257f4814b0c239c260c4caaadf0@redhat.com>

zippy2/libvirt-php,libvirt/libvirt-php,zippy2/libvirt-php,libvirt/libvirt-php,libvirt/libvirt-php,zippy2/libvirt-php