aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-08-04 20:03:03 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-08-04 20:08:58 +0100
commitfdb9b51c3f39bede186061b40da196e6816dcb2b (patch)
tree1adbf46ff5654bde497afbb17887f72240ab647a
parent30fbc572929e25e73cb916625b5d78dafe9a47f7 (diff)
downloadpaludis-fdb9b51c3f39bede186061b40da196e6816dcb2b.tar.gz
paludis-fdb9b51c3f39bede186061b40da196e6816dcb2b.tar.xz
Validate input
-rw-r--r--paludis/resolver/job_list.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/paludis/resolver/job_list.cc b/paludis/resolver/job_list.cc
index 762dd53..e5e03a7 100644
--- a/paludis/resolver/job_list.cc
+++ b/paludis/resolver/job_list.cc
@@ -21,6 +21,8 @@
#include <paludis/resolver/job.hh>
#include <paludis/util/pimp-impl.hh>
#include <paludis/util/wrapped_forward_iterator-impl.hh>
+#include <paludis/util/exception.hh>
+#include <paludis/util/stringify.hh>
#include <paludis/serialise-impl.hh>
#include <vector>
@@ -86,6 +88,8 @@ template <typename Job_>
typename JobList<Job_>::ConstIterator
JobList<Job_>::fetch(const JobNumber n) const
{
+ if (n < 0 || n >= JobNumber(_imp->list.size()))
+ throw InternalError(PALUDIS_HERE, "n is " + stringify(n) + " but size is " + stringify(_imp->list.size()));
return ConstIterator(_imp->list.begin() + n);
}