diff --git a/tools/probetest.c b/tools/probetest.c
index f8a617ddeaf81e97c95afa887ffd917462102975..29c27e4bf5c286474ce10418154b8fc037e5e900 100644
--- a/tools/probetest.c
+++ b/tools/probetest.c
@@ -63,6 +63,16 @@ int main(int argc, char **argv)
     if(argc >= 3)
         max_size = atoi(argv[2]);
 
+    if (max_size > 1000000000U/8) {
+        fprintf(stderr, "max_size out of bounds\n");
+        return 1;
+    }
+
+    if (retry_count > 1000000000U) {
+        fprintf(stderr, "retry_count out of bounds\n");
+        return 1;
+    }
+
     avcodec_register_all();
     av_register_all();