Uploaded image for project: 'Axis-C++'
  1. Axis-C++
  2. AXISCPP-107

Memory Access Violation

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • None
    • 1.3 Beta
    • Transport (Client)
    • None
    • Win32 Client compiled using VC++ 6

    Description

      I've previously used the Axis Java client code to great success but am now trying to work through a simple SOAP client in C++ and having great difficulty and am receiving an Access Violation. Using the Visual C++ debugger I trace the code down into
      SoapSerializer::operator <<(const AxisChar* cSerialized)

      And see that the violation is occuring at:
      strcat((char*)m_pSZBuffers[m_nCurrentBufferIndex].buffer,
      cSerialized);

      I am trying to send up an XSD_STRING parameter that is the contents of a file. After escaping the size of the buffer is just under 11,000 bytes. In digging through the source code it appears to me that the size of the buffer that the strcat is attempting to go into is 1024 bytes which will result in an access violation as I ingloriously overwrite memory. I'm guessing this because previous in the method I see
      int iTmpSerBufferSize = strlen(cSerialized);
      if((m_nFilledSize + iTmpSerBufferSize)>= m_nCurrentBufferSize)

      And m_nCurrentBufferSize is 1024. When SetNextSerializeBuffer is called the next buffer is allocated at 2048 under the assumption that that will be sufficient. Shortly after that the call to
      strcat((char*)m_pSZBuffers[m_nCurrentBufferIndex].buffer,
      cSerialized);

      Is made using the 2048 byte buffer. Yes, I am using strcat to write 10K worth of data into a 2K buffer at which point the access violation occurs.

      At some point SetNextSerializeBuffer or the code calling SetNextSerializeBuffer will have to take into account the amount of memory that is actually required by the application.

      rjsjr

      Attachments

        Activity

          People

            Unassigned Unassigned
            wobbet Robert J. Sanford, Jr.
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: