qpid-proton mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bozo Dragojevic (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (PROTON-246) Described value at the end of a map screws up pn_data_appendn() - this screws up link attaches with filters
Date Thu, 21 Feb 2013 16:16:13 GMT

    [ https://issues.apache.org/jira/browse/PROTON-246?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13583313#comment-13583313
] 

Bozo Dragojevic commented on PROTON-246:
----------------------------------------

I think this is duplicate of PROTON-230. I've attached a patch for that one
                
> Described value at the end of a map screws up pn_data_appendn() - this screws up link
attaches with filters
> -----------------------------------------------------------------------------------------------------------
>
>                 Key: PROTON-246
>                 URL: https://issues.apache.org/jira/browse/PROTON-246
>             Project: Qpid Proton
>          Issue Type: Bug
>    Affects Versions: 0.3
>            Reporter: Andrew Stitcher
>            Assignee: Andrew Stitcher
>
> Replication code (in C++):
> #include <string>
> #include "proton/codec.h"
> pn_bytes_t convert(const std::string& s)
> {
>     pn_bytes_t result;
>     result.start = const_cast<char*>(s.data());
>     result.size = s.size();
>     return result;
> }
> int main() {
>         pn_data_t* filter = pn_data(16);
>         pn_data_put_map(filter);
>         pn_data_enter(filter);
>         pn_data_put_symbol(filter, convert("qpid.selector"));
>         pn_data_put_described(filter);
>         pn_data_enter(filter);
>         pn_data_put_symbol(filter, convert("qpid.apache.org:selector:string"));
>         pn_data_put_string(filter, convert("selector-here"));
>         pn_data_exit(filter);
>         pn_data_exit(filter);
>         pn_data_put_symbol(filter, convert("foo"));
>         pn_data_put_string(filter, convert("bar"));
>         pn_data_dump(filter);
>         
>         pn_data_t* out = pn_data(16);
>         pn_data_t* symbol = pn_data(16);
>         pn_data_put_symbol(symbol, convert("booboo"));
>         pn_data_fill(out, "CC", filter, symbol);
>         
>         pn_data_dump(out);
> }
> This outputs:
> {current=7, parent=0}
> Node 1: prev=0, next=6, parent=0, down=2, children=2, type=24 (map[0])
> Node 2: prev=0, next=3, parent=1, down=0, children=0, type=20 (:"qpid.selector")
> Node 3: prev=2, next=0, parent=1, down=4, children=2, type=21 (descriptor)
> Node 4: prev=0, next=5, parent=3, down=0, children=0, type=20 (:"qpid.apache.org:selector:string")
> Node 5: prev=4, next=0, parent=3, down=0, children=0, type=19 ("selector-here")
> Node 6: prev=1, next=7, parent=0, down=0, children=0, type=20 (:foo)
> Node 7: prev=6, next=0, parent=0, down=0, children=0, type=19 ("bar")
> {current=6, parent=1}
> Node 1: prev=0, next=0, parent=0, down=2, children=3, type=24 (map[0])
> Node 2: prev=0, next=3, parent=1, down=0, children=0, type=20 (:"qpid.selector")
> Node 3: prev=2, next=6, parent=1, down=4, children=2, type=21 (descriptor)
> Node 4: prev=0, next=5, parent=3, down=0, children=0, type=20 (:"qpid.apache.org:selector:string")
> Node 5: prev=4, next=0, parent=3, down=0, children=0, type=19 ("selector-here")
> Node 6: prev=3, next=0, parent=1, down=0, children=0, type=20 (:booboo)
> Which is wrong: note that the final node is erroneously a child of the map.
> I have traced this behaviour to these lines in pn_data_appendn()
> ...
>     while (!pn_data_next(src)) {
>       if (level > 0) {
>         pn_data_exit(data);
>         pn_data_exit(src);
>         level--;
>       }
>       if (pn_data_next(src)) {
>         break;
>       } else {
>         stop = true;
>         break;
>       }
>     }
> ...
> Where the code is trying to walk up a level at the end of a sublist, but pn_data_next()
does something much more complex than merely walking the sublists and so this fails somehow.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message