From dev-return-104357-archive-asf-public=cust-asf.ponee.io@qpid.apache.org Tue Aug 18 13:02:09 2020 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mailroute1-lw-us.apache.org (mailroute1-lw-us.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with ESMTPS id BCCE3180652 for ; Tue, 18 Aug 2020 15:02:08 +0200 (CEST) Received: from mail.apache.org (localhost [127.0.0.1]) by mailroute1-lw-us.apache.org (ASF Mail Server at mailroute1-lw-us.apache.org) with SMTP id 122E112577E for ; Tue, 18 Aug 2020 13:02:07 +0000 (UTC) Received: (qmail 73250 invoked by uid 500); 18 Aug 2020 13:02:05 -0000 Mailing-List: contact dev-help@qpid.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@qpid.apache.org Delivered-To: mailing list dev@qpid.apache.org Received: (qmail 73077 invoked by uid 99); 18 Aug 2020 13:02:05 -0000 Received: from mailrelay1-us-west.apache.org (HELO mailrelay1-us-west.apache.org) (209.188.14.139) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 18 Aug 2020 13:02:05 +0000 Received: from jira-he-de.apache.org (static.172.67.40.188.clients.your-server.de [188.40.67.172]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 83A9D45AAC for ; Tue, 18 Aug 2020 13:02:04 +0000 (UTC) Received: from jira-he-de.apache.org (localhost.localdomain [127.0.0.1]) by jira-he-de.apache.org (ASF Mail Server at jira-he-de.apache.org) with ESMTP id C38547825CE for ; Tue, 18 Aug 2020 13:02:01 +0000 (UTC) Date: Tue, 18 Aug 2020 13:02:01 +0000 (UTC) From: "ASF subversion and git services (Jira)" To: dev@qpid.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (PROTON-2244) [Proton-c] Encoder error for array of lists where first list in array is empty MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/PROTON-2244?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17179610#comment-17179610 ] ASF subversion and git services commented on PROTON-2244: --------------------------------------------------------- Commit e4e0342b9f824ef481002f9ae0c98cece090fc5e in qpid-proton's branch refs/heads/master from Kim van der Riet [ https://gitbox.apache.org/repos/asf?p=qpid-proton.git;h=e4e0342 ] PROTON-2244: Fix for Array of lists with first list empty encoding PROTON-2244: Correction on previous fix, prevent zero-length array encoding for all array memebers of an array PROTON-2244: Minor correction to comment text PROTON-2244: Added a set of array encode-decode tests for Data.Array, including a array of lists test which catches this bug. PROTON-2244: Removed array codec tests from Python to C/C++ tests as requested PROTON-2244: Removed debug statements erroneously left in code from previous commit PROTON-2244: Fix for non-linux compilers and non-portable float types PROTON-2244: Further improvements to array check: fail if error during encoding or decoding PROTON-2244: Added tests for arrays of char and decimal32/64/128. PROTON-2244: Added some additional arrays of list test cases PROTON-2244: Removed array tests of all but array of lists, as this is the issue. The consensus is that we need to make the tests compare encoded bytes with expected encoded bytes, not perform an encode/decode comparison as these tests do at present. This should be done at a later time. NO_JIRA: Removed header files which are no longer used in c/tests/data_test.cpp > [Proton-c] Encoder error for array of lists where first list in array is empty > ------------------------------------------------------------------------------ > > Key: PROTON-2244 > URL: https://issues.apache.org/jira/browse/PROTON-2244 > Project: Qpid Proton > Issue Type: Task > Components: proton-c > Reporter: Kim van der Riet > Priority: Major > > AMQP encodes arrays with a single element constructor which should be identical for all elements in the array. However, if an array of lists is constructed in which the first list is empty, then the AMQP empty list constructor is used in the array, and the following lists which may be non-empty, will not be decoded correctly. > {noformat} > >>> import proton > >>> a = proton.Array(proton.UNDESCRIBED, proton.Data.LIST, [], [1,2,3], ['aaa', 'bbb', 'ccc']) > >>> d1 = proton.Data() > >>> d1.put_py_array(a) > >>> d1.encode().hex() > 'f00000002a00000003450000000a000000035501550255030000001300000003a103616161a103626262a103636363' > {noformat} > which, when broken down into parts, looks as follows: > {noformat} > f0 000002a 00000003 45 <-- Array constructor, size=0x2a, len=3, type=empty list > ^^--- Empty list constructor > 0000000a 00000003 5501 5502 5503 <- data for [1,2,3] > 00000013 00000003 a103616161 a103626262 a103636363 <-- data for ['aaa', 'bbb', 'ccc'] > {noformat} > When decoded, this is being interpreted as an array of empty lists: > {noformat} > >>> d2 = proton.Data() > >>> d2.decode(d1.encode()) > 10 > >>> d2.get_py_array() > Array(UNDESCRIBED, 24, [], [], []) > {noformat} > When a mis-encoded array is used in the body of a message and is decoded, an error results: > {noformat} > >>> import proton > >>> a = proton.Array(proton.UNDESCRIBED, proton.Data.LIST, [], [1,2,3], ['aaa', 'bbb', 'ccc']) > >>> m1 = proton.Message(body=a) > >>> m1 > Message(priority=4, body=Array(UNDESCRIBED, 24, [], [1, 2, 3], ['aaa', 'bbb', 'ccc'])) > >>> m2 = proton.Message() > >>> m2.decode(m1.encode()) > Traceback (most recent call last): > File "", line 1, in > File "/home/kvdr/RedHat/install/lib64/proton/bindings/python3/proton/_message.py", line 488, in decode > self._check(pn_message_decode(self._msg, data)) > File "/home/kvdr/RedHat/install/lib64/proton/bindings/python3/proton/_message.py", line 87, in _check > raise exc("[%s]: %s" % (err, pn_error_text(pn_message_error(self._msg)))) > proton._exceptions.MessageException: [-6]: data error: (null) > {noformat} -- This message was sent by Atlassian Jira (v8.3.4#803005) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org For additional commands, e-mail: dev-help@qpid.apache.org