[New-bugs-announce] [issue16513] SGMLParser processing <tr> which include two <a> will have problem

moonflow report at bugs.python.org
Tue Nov 20 15:09:36 CET 2012


New submission from moonflow:

if a <tr> include two <a> or more,SGMLParser processing has a problem

for example:
    <tr>
    <td align="center" valign="top" nowrap>
    <script language="Javascript">
    <!--
      if ( 4 == 4 ) document.write("<strong class=\"Critical small\">Critical</strong>");
      if ( 4 == 3 ) document.write("<strong class=\"High small\">High</strong>");
      if ( 4 == 2 ) document.write("<strong class=\"Medium small\">Medium</strong>");
      if ( 4 == 1 ) document.write("<strong class=\"Low small\">Low</strong>");
    //--> 
    </script>
    </td>
    <td valign="top" align="center" nowrap>
    <small><script type="text/javascript">document.write(FormatDate("%d-%b-%y", "2012", "11", "18"));</script></small>
    </td>
    <td valign="top" align="center" nowrap><small>
    <a title="CPAI-2012-809" style="text-transform:uppercase" href="2012/cpai-08-nov.html">
    CPAI-2012-809</a></small>
    </td>
    <td valign="top" nowrap align="center"><small>
    <a target="_blank" href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2011-2089">CVE-2011-2089</a><br /></small>
    </td>
    <td valign="top"><small>SCADA ICONICS WebHMI ActiveX Stack Overflow (2011-2089)</small></td>
    </tr>

def start_a(self, attrs):
        if self.is_td:       
            cve_href = [v for k, v in attrs if k == "target" and v == "_blank"]
            if cve_href:
                self.is_a = True
                self.is_cve = True

            #for SGMLParser maybe have a bug,a <tr> have two <a> has problem
            vul_href = [v for k, v in attrs if k == "style"]
            print vul_href
            if vul_href:
                vul_href = "".join([v for k, v in attrs if k == "href"])
                if vul_href.find("cve") == -1:
                    self.href_name = vul_href     
            else:
                self.href_name = ""

here print vul_href but print nothing.Is it ok?

----------
components: Library (Lib)
files: testbug.py
messages: 175990
nosy: moonflow
priority: normal
severity: normal
status: open
title: SGMLParser processing <tr> which include two <a> will have problem
type: behavior
versions: Python 2.7
Added file: http://bugs.python.org/file28049/testbug.py

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16513>
_______________________________________


More information about the New-bugs-announce mailing list