Skip to content

std::bad_alloc exception in pcp example #14

Description

@GoogleCodeExporter
What steps will reproduce the problem?
1. run the pcp example program

What is the expected output? What do you see instead?
The program crashes with std::bad_alloc exception.

What version of the product are you using? On what operating system?
libjingle 0.4
Gentoo Linux 
kernel: 2.6.17-gentoo-r4
x86_64 AMD Opteron
gcc 4.1.1

Please provide any additional information below.
The problem is in talk/base/httpbase.cc
bool HttpParser::process_line()

if (MatchHeader(line, nlen, HH_CONTENT_LENGTH)) {
        if (sscanf(value, "%d", &data_size_) != 1) {
          err = HE_PROTOCOL;
          break;
        }
}

data_size_ won't be correct. 
The following code works fine.

if (MatchHeader(line, nlen, HH_CONTENT_LENGTH)) {
        unsigned int temp_size;
        if (sscanf(value, "%d", &temp_size) != 1) {
          err = HE_PROTOCOL;
          break;
        }
        data_size_=temp_size;
}

Original issue reported on code.google.com by peter.fe...@gmail.com on 31 Jul 2007 at 9:10

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions