Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#36 Complete Fix for recent seg fault problems?

open
nobody
None
7
2004-07-20
2004-07-15
s bond
No

I kept getting a seg fault on auction update, probably
due to changes in eBay's html for auction pages. On
accident I was able to fix it by stripping out all the
"<script>" sections in the html. The patch follows if
it helps anyone.

In helpers.cpp (patched)

for (u = 0; u < buffLength; u++) {
c = stringToStrip[u];
if (u + 6 < buffLength &&
strncmp(&stringToStrip[u],"<scrip",6) == 0)
IncludeFlag = 6;
else if (u + 7 < buffLength &&
strncmp(&stringToStrip[u],"</scrip",7) == 0)
IncludeFlag = 5;
else if (c == '<') IncludeFlag=5;

The unpatched version is here for your reference:

for (u = 0; u < buffLength; u++) {
c = stringToStrip[u];
if (c == '<') IncludeFlag=5;

Let me know if you want more info. There are still some
strange things going on, with some extra text being
inserted into
the comments section of the item. At least this fixes
the seg fault. -SB

Discussion

  • s bond
    s bond
    2004-07-20

    Logged In: YES
    user_id=1084057

    Just as a follow up to this patch, I have tweaked it a bit
    more which seems to fix most all of the problems at this
    point, although I haven't fully tested it under all
    situations. Basically the point is to remove all sections
    of the HTML matching: <script .... </script>.
    I've attached the patched helpers.cpp file for anyone
    interested in having a look. This is from version 1.3.15
    ... Once again let me know if you have any questions or
    comments about it. I'll patch updates if I find a better
    fix. -SB

     
  • s bond
    s bond
    2004-07-20

    Logged In: YES
    user_id=1084057

    Final follow up (hopefully). I think the problem is that
    the program removes all the HTML tags, but does not account
    for the spacing that each tag represents. For example, <br>
    <td> and <tr> tags introduce visual spacing and when they
    are removed you really need to replace them with spaces or
    newlines? So this final patched helpers.cpp file does this
    and appears to fix all the problems with parsing. It's not
    the most compact solution but it is working perfectly for
    me. Let me know if you have any questions. -SB

     
  • s bond
    s bond
    2004-07-20

    Patch for helpers.cpp

     
  • s bond
    s bond
    2004-07-20

    Patched version of helpers.cpp file.

     
    Attachments
  • s bond
    s bond
    2004-07-20

    • priority: 5 --> 7
    • summary: Partial Fix for recent seg fault problems. --> Complete Fix for recent seg fault problems?