From 7ae05b9935fa74d900c8733b4723e692b493a6f9 Mon Sep 17 00:00:00 2001 From: Julian Orth Date: Thu, 5 Jun 2014 22:35:32 +0200 Subject: [PATCH] prevent infinite loop --- factor/factor.rs | 3 +++ md5sum/rust-crypto | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/factor/factor.rs b/factor/factor.rs index 5d78cab0e..fcb87bb95 100644 --- a/factor/factor.rs +++ b/factor/factor.rs @@ -27,6 +27,9 @@ static NAME: &'static str = "factor"; fn factor(mut num: u64) -> Vec { let mut ret = Vec::new(); + if num < 2 { + return ret; + } while num % 2 == 0 { num /= 2; ret.push(2); diff --git a/md5sum/rust-crypto b/md5sum/rust-crypto index adde85617..1711f3a64 160000 --- a/md5sum/rust-crypto +++ b/md5sum/rust-crypto @@ -1 +1 @@ -Subproject commit adde85617a776ea98249504d653cb547a2353c98 +Subproject commit 1711f3a648a5ee1519963820f742b28693c1ce6d