mirror of
https://github.com/aria2/aria2.git
synced 2025-04-05 13:37:40 +03:00
Only accepts 32 bit integer values from int and i4 elements in XML-RPC.
Fixed overflow in AbstractPaginationRpcMethod::getPaginationRange(). Fixes bug#3494165
This commit is contained in:
parent
7a1cba2c59
commit
ad11d746f0
3 changed files with 38 additions and 8 deletions
|
@ -652,6 +652,36 @@ void RpcMethodTest::testTellWaiting()
|
|||
CPPUNIT_ASSERT_EQUAL(0, res.code);
|
||||
resParams = downcast<List>(res.param);
|
||||
CPPUNIT_ASSERT_EQUAL((size_t)3, resParams->size());
|
||||
|
||||
// offset = INT32_MAX
|
||||
req.params->set(0, Integer::g(INT32_MAX));
|
||||
req.params->set(1, Integer::g(1));
|
||||
res = m.execute(req, e_.get());
|
||||
CPPUNIT_ASSERT_EQUAL(0, res.code);
|
||||
resParams = downcast<List>(res.param);
|
||||
CPPUNIT_ASSERT_EQUAL((size_t)0, resParams->size());
|
||||
// num = INT32_MAX
|
||||
req.params->set(0, Integer::g(1));
|
||||
req.params->set(1, Integer::g(INT32_MAX));
|
||||
res = m.execute(req, e_.get());
|
||||
CPPUNIT_ASSERT_EQUAL(0, res.code);
|
||||
resParams = downcast<List>(res.param);
|
||||
CPPUNIT_ASSERT_EQUAL((size_t)3, resParams->size());
|
||||
// offset=INT32_MAX and num = INT32_MAX
|
||||
req.params->set(0, Integer::g(INT32_MAX));
|
||||
req.params->set(1, Integer::g(INT32_MAX));
|
||||
res = m.execute(req, e_.get());
|
||||
CPPUNIT_ASSERT_EQUAL(0, res.code);
|
||||
resParams = downcast<List>(res.param);
|
||||
CPPUNIT_ASSERT_EQUAL((size_t)0, resParams->size());
|
||||
// offset=INT32_MIN and num = INT32_MAX
|
||||
req.params->set(0, Integer::g(INT32_MIN));
|
||||
req.params->set(1, Integer::g(INT32_MAX));
|
||||
res = m.execute(req, e_.get());
|
||||
CPPUNIT_ASSERT_EQUAL(0, res.code);
|
||||
resParams = downcast<List>(res.param);
|
||||
CPPUNIT_ASSERT_EQUAL((size_t)0, resParams->size());
|
||||
|
||||
// negative offset
|
||||
req = RpcRequest(TellWaitingRpcMethod::getMethodName(), List::g());
|
||||
req.params->append(Integer::g(-1));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue