Return-Path: Delivered-To: apmail-ws-axis-c-dev-archive@www.apache.org Received: (qmail 36074 invoked from network); 10 Sep 2009 06:07:20 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 10 Sep 2009 06:07:20 -0000 Received: (qmail 23953 invoked by uid 500); 10 Sep 2009 06:07:19 -0000 Delivered-To: apmail-ws-axis-c-dev-archive@ws.apache.org Received: (qmail 23885 invoked by uid 500); 10 Sep 2009 06:07:19 -0000 Mailing-List: contact axis-c-dev-help@ws.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: "Apache AXIS C Developers List" Reply-To: "Apache AXIS C Developers List" Delivered-To: mailing list axis-c-dev@ws.apache.org Received: (qmail 23876 invoked by uid 99); 10 Sep 2009 06:07:19 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 10 Sep 2009 06:07:19 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 10 Sep 2009 06:07:17 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 839B2234C055 for ; Wed, 9 Sep 2009 23:06:57 -0700 (PDT) Message-ID: <1825868464.1252562817538.JavaMail.jira@brutus> Date: Wed, 9 Sep 2009 23:06:57 -0700 (PDT) From: "S.Uthaiyashankar (JIRA)" To: axis-c-dev@ws.apache.org Subject: [jira] Resolved: (AXIS2C-1375) Guththila XML writer serialize soap incorrectly so that a soap message being sent out contains gabage characters In-Reply-To: <705932399.1244240647346.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/AXIS2C-1375?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] S.Uthaiyashankar resolved AXIS2C-1375. -------------------------------------- Resolution: Fixed Fixed in revision 813238. Thank you every one for contributing. > Guththila XML writer serialize soap incorrectly so that a soap message being sent out contains gabage characters > ---------------------------------------------------------------------------------------------------------------- > > Key: AXIS2C-1375 > URL: https://issues.apache.org/jira/browse/AXIS2C-1375 > Project: Axis2-C > Issue Type: Bug > Components: guththila > Affects Versions: 1.6.0 > Environment: windows XP > Reporter: Frank Zhou > Assignee: S.Uthaiyashankar > Priority: Blocker > Fix For: Next Version > > Attachments: guththila.diff, guththila_xml_writer.c, guththila_xml_writer.c, testGuththilaBufferError.xml, testingCodeSnappet.cpp > > > OK, since no one reply to my question, I have to debug the code and found out that guththila has a bug in managing buffer when seriazlize thea axiom tree (the soap structure) before actually send out the request, and I have a potential fix. This is really a critical bug I think, so I hope some developers can take a look at this problem. I am attaching the test input data and code snappet to reproduce the problem. > > Basically, the bug occurs in guththila_xml_writer.c. The guththila_xml_writer (I call it the soap serializer) maintains an array of buffers dynamically when it writes the soap structure into the buffers. The bug will occur in the following situation: > > Let's say I have an element 12345 somewhere in the soap structure. Now before this element, there are lots of other elements, and when the guththila_xml_writer trys to process this element, the first buffer is ALMOST full, it does not have enough space to write the whole element name (the start tag) into the buffer, it has to create a new buffer, so it writes > The first buffer (Buffer length 16384): > -------------------------------------------------------------------------- > |************************************************** > The second buffer (Buffer length 32768): > --------------------------------------------------------------------------------------------------------------------------- > |doDeleteFirst-------------------------------------------------------------------------------------------------------------| > > As the second buffer becomes the current buffer, when the writer trys to process the end tag (), it uses an elem stack to track the namespace prefix and localname as in the following code: (starting from line 1396) > > elem->name = guththila_tok_list_get_token(&wr->tok_list, env); > elem->prefix = guththila_tok_list_get_token(&wr->tok_list, env); > elem->name->start = GUTHTHILA_BUF_POS(wr->buffer, elem_start); > elem->name->size = elem_len; > elem->prefix->start = GUTHTHILA_BUF_POS(wr->buffer, elem_pref_start); > elem->prefix->size = pref_len; > > The macro GUTHTHILA_BUF_POS is defined as this: > > #ifndef GUTHTHILA_BUF_POS > #define GUTHTHILA_BUF_POS(_buffer, _pos) > ((_buffer).buff[(_buffer).cur_buff] + _pos - (_buffer).pre_tot_data) > #endif > The bug occurs when it calcuate elem->prefix->start = GUTHTHILA_BUF_POS(wr->buffer, elem_pref_start): > > The elem_pref_start has a value of 16375, the pre_tot_data has a value of 16379 (the first buffer length is 16384), they are calculated based on the first buffer data, but the current buffer is the second one, so elem->prefix->start points to gabage! > > I hope this makes sense to you. Use my test case you will see this quickly. When you run the same XML data I attached, first set a break point at line 392 in the file guththila_xml_writer_wrapper, and set the hit count as 514 in the break properties (the 514th element in ), then debug step by step. > > The potential fix is to define GUTHTHILA_BUF_POS as the following: > > if ((_buffer)->pre_tot_data > _pos) > return ((_buffer)->buff[(_buffer)->cur_buff-1] + _pos); > else > return ((_buffer)->buff[(_buffer)->cur_buff] + _pos - (_buffer)->pre_tot_data); > GUTHTHILA_BUF_POS is used everywhere, so I really hope some developer can take over this case and fix it! > -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.