summaryrefslogtreecommitdiff
path: root/qpid/extras/dispatch
diff options
context:
space:
mode:
authorTed Ross <tross@apache.org>2013-07-15 12:41:48 +0000
committerTed Ross <tross@apache.org>2013-07-15 12:41:48 +0000
commit502887811360345c073eb8b7c3e814e958bf8140 (patch)
treee4a25c69da343b1bb14205aa78efba54fd7e8696 /qpid/extras/dispatch
parentc9de50719b7d7566cc4f0f2cae39bbcf824420de (diff)
downloadqpid-python-502887811360345c073eb8b7c3e814e958bf8140.tar.gz
NO-JIRA - Fixed bug in parse-error handling.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1503204 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/extras/dispatch')
-rw-r--r--qpid/extras/dispatch/src/iterator.c2
-rw-r--r--qpid/extras/dispatch/src/parse.c3
-rw-r--r--qpid/extras/dispatch/tests/parse_test.c2
3 files changed, 5 insertions, 2 deletions
diff --git a/qpid/extras/dispatch/src/iterator.c b/qpid/extras/dispatch/src/iterator.c
index eb302fe9ad..ca9f4d7832 100644
--- a/qpid/extras/dispatch/src/iterator.c
+++ b/qpid/extras/dispatch/src/iterator.c
@@ -367,7 +367,7 @@ dx_field_iterator_t *dx_field_iterator_sub(dx_field_iterator_t *iter, uint32_t l
void dx_field_iterator_advance(dx_field_iterator_t *iter, uint32_t length)
{
// TODO - Make this more efficient.
- for (uint8_t idx = 0; idx < length; idx++)
+ for (uint8_t idx = 0; idx < length && !dx_field_iterator_end(iter); idx++)
dx_field_iterator_octet(iter);
}
diff --git a/qpid/extras/dispatch/src/parse.c b/qpid/extras/dispatch/src/parse.c
index bb1f4ef171..ebf76f63d7 100644
--- a/qpid/extras/dispatch/src/parse.c
+++ b/qpid/extras/dispatch/src/parse.c
@@ -94,6 +94,9 @@ static char *get_type_info(dx_field_iterator_t *iter, uint8_t *tag, uint32_t *le
if ((*tag == DX_AMQP_MAP8 || *tag == DX_AMQP_MAP32) && (*count & 1))
return "Odd Number of Elements in a Map";
+ if (*clen > *length)
+ return "Insufficient Length to Determine Count";
+
return 0;
}
diff --git a/qpid/extras/dispatch/tests/parse_test.c b/qpid/extras/dispatch/tests/parse_test.c
index d11bb4e359..124ba1c0d4 100644
--- a/qpid/extras/dispatch/tests/parse_test.c
+++ b/qpid/extras/dispatch/tests/parse_test.c
@@ -123,7 +123,7 @@ struct err_vector_t {
{"\xb0\x00\x00", 3, "Insufficient Data to Determine Length"}, // 6
{"\xb0\x00\x00\x00", 4, "Insufficient Data to Determine Length"}, // 7
{"\xc0\x04", 2, "Insufficient Data to Determine Count"}, // 8
-{"\xd0\x00\x00\x00\x00\x00\x00\x00\x01", 9, "Insufficient Data to Determine Tag"}, // 9
+{"\xd0\x00\x00\x00\x00\x00\x00\x00\x01", 9, "Insufficient Length to Determine Count"}, // 9
{0, 0, 0}
};