diff options
author | Hermann Felbinger <hermann19829@gmail.com> | 2017-08-26 09:15:52 +0100 |
---|---|---|
committer | Chris Johns <chrisj@rtems.org> | 2017-08-29 18:05:38 +1000 |
commit | b857151112fe5ae05f20447e2598123a3bce1657 (patch) | |
tree | 9673fe3fecc4b81f64ee553bb89adbf4960c7314 | |
parent | covoar/qemu-traces.h: Change to match current couverture-qemu file. (diff) | |
download | rtems-tools-b857151112fe5ae05f20447e2598123a3bce1657.tar.bz2 |
covoar: Fix buffer overflow and fix br tag in html report.
Co-Author: Krzysztof Miesowicz <krzysztof.miesowicz@gmail.com>
-rw-r--r-- | tester/covoar/ReportsBase.cc | 11 | ||||
-rw-r--r-- | tester/covoar/ReportsHtml.cc | 46 |
2 files changed, 29 insertions, 28 deletions
diff --git a/tester/covoar/ReportsBase.cc b/tester/covoar/ReportsBase.cc index b61fc76..01950d0 100644 --- a/tester/covoar/ReportsBase.cc +++ b/tester/covoar/ReportsBase.cc @@ -210,10 +210,11 @@ void ReportsBase::WriteAnnotatedReport( itr != theInstructions->end(); itr++ ) { - uint32_t id = 0; - std::string annotation = ""; - std::string line; - char textLine[150]; + uint32_t id = 0; + std::string annotation = ""; + std::string line; + const std::size_t LINE_LENGTH = 150; + char textLine[LINE_LENGTH]; state = A_SOURCE; @@ -236,7 +237,7 @@ void ReportsBase::WriteAnnotatedReport( } } - sprintf( textLine, "%-70s", itr->line.c_str() ); + snprintf( textLine, LINE_LENGTH, "%-70s", itr->line.c_str() ); line = textLine + annotation; PutAnnotatedLine( aFile, state, line, id); diff --git a/tester/covoar/ReportsHtml.cc b/tester/covoar/ReportsHtml.cc index 101c76b..247253c 100644 --- a/tester/covoar/ReportsHtml.cc +++ b/tester/covoar/ReportsHtml.cc @@ -52,7 +52,7 @@ namespace Coverage { #define PRINT_TEXT_ITEM( _t, _n ) \ fprintf( \ aFile, \ - "<li>%s (<a href=\"%s\">text</a>)\n", \ + "<li>%s (<a href=\"%s\">text</a>)</li>\n", \ _t, _n ); FILE* aFile; @@ -69,7 +69,7 @@ namespace Coverage { if (projectName) fprintf( aFile, - "%s</br>", + "%s<br>", projectName ); @@ -93,7 +93,7 @@ namespace Coverage { fprintf( aFile, - "</li>\n" + "</ul>\n" "<!-- INSERT PROJECT SPECIFIC ITEMS HERE -->\n" "</html>\n" ); @@ -144,7 +144,7 @@ namespace Coverage { if (projectName) fprintf( aFile, - "%s</br>", + "%s<br>", projectName ); @@ -181,7 +181,7 @@ namespace Coverage { if (projectName) fprintf( aFile, - "%s</br>", + "%s<br>", projectName ); @@ -197,7 +197,7 @@ namespace Coverage { "<th class=\"table-sortable:default\" align=\"left\">Symbol</th>\n" "<th class=\"table-sortable:default\" align=\"left\">Line</th>\n" "<th class=\"table-filterable table-sortable:default\" align=\"left\">File</th>\n" - "<th class=\"table-sortable:numeric\" align=\"left\">Size </br>Bytes</th>\n" + "<th class=\"table-sortable:numeric\" align=\"left\">Size <br>Bytes</th>\n" "<th class=\"table-sortable:default\" align=\"left\">Reason</th>\n" "<th class=\"table-filterable table-sortable:default\" align=\"left\">Taken</th>\n" "<th class=\"table-filterable table-sortable:default\" align=\"left\">Not Taken</th>\n" @@ -232,7 +232,7 @@ namespace Coverage { if (projectName) fprintf( aFile, - "%s</br>", + "%s<br>", projectName ); @@ -248,8 +248,8 @@ namespace Coverage { "<th class=\"table-sortable:default\" align=\"left\">Symbol</th>\n" "<th class=\"table-sortable:default\" align=\"left\">Range</th>\n" "<th class=\"table-filterable table-sortable:default\" align=\"left\">File</th>\n" - "<th class=\"table-sortable:numeric\" align=\"left\">Size </br>Bytes</th>\n" - "<th class=\"table-sortable:numeric\" align=\"left\">Size </br>Instructions</th>\n" + "<th class=\"table-sortable:numeric\" align=\"left\">Size <br>Bytes</th>\n" + "<th class=\"table-sortable:numeric\" align=\"left\">Size <br>Instructions</th>\n" "<th class=\"table-filterable table-sortable:default\" align=\"left\">Classification</th>\n" "<th class=\"table-sortable:default\" align=\"left\">Explanation</th>\n" "</tr>\n" @@ -281,7 +281,7 @@ namespace Coverage { if (projectName) fprintf( aFile, - "%s</br>", + "%s<br>", projectName ); @@ -326,7 +326,7 @@ namespace Coverage { if (projectName) fprintf( aFile, - "%s</br>", + "%s<br>", projectName ); @@ -371,7 +371,7 @@ namespace Coverage { if (projectName) fprintf( aFile, - "%s</br>", + "%s<br>", projectName ); @@ -385,16 +385,16 @@ namespace Coverage { "<thead>\n" "<tr>\n" "<th class=\"table-sortable:default\" align=\"center\">Symbol</th>\n" - "<th class=\"table-sortable:numeric\" align=\"center\">Total</br>Size</br>Bytes</th>\n" - "<th class=\"table-sortable:numeric\" align=\"center\">Total</br>Size</br>Instr</th>\n" - "<th class=\"table-sortable:numeric\" align=\"center\">#</br>Ranges</th>\n" - "<th class=\"table-sortable:numeric\" align=\"center\">Uncovered</br>Size</br>Bytes</th>\n" - "<th class=\"table-sortable:numeric\" align=\"center\">Uncovered</br>Size</br>Instr</th>\n" - "<th class=\"table-sortable:numeric\" align=\"center\">#</br>Branches</th>\n" - "<th class=\"table-sortable:numeric\" align=\"center\">#</br>Always</br>Taken</th>\n" - "<th class=\"table-sortable:numeric\" align=\"center\">#</br>Never</br>Taken</th>\n" - "<th class=\"table-sortable:numeric\" align=\"center\">Percent</br>Uncovered</br>Instructions</th>\n" - "<th class=\"table-sortable:numeric\" align=\"center\">Percent</br>Uncovered</br>Bytes</th>\n" + "<th class=\"table-sortable:numeric\" align=\"center\">Total<br>Size<br>Bytes</th>\n" + "<th class=\"table-sortable:numeric\" align=\"center\">Total<br>Size<br>Instr</th>\n" + "<th class=\"table-sortable:numeric\" align=\"center\">#<br>Ranges</th>\n" + "<th class=\"table-sortable:numeric\" align=\"center\">Uncovered<br>Size<br>Bytes</th>\n" + "<th class=\"table-sortable:numeric\" align=\"center\">Uncovered<br>Size<br>Instr</th>\n" + "<th class=\"table-sortable:numeric\" align=\"center\">#<br>Branches</th>\n" + "<th class=\"table-sortable:numeric\" align=\"center\">#<br>Always<br>Taken</th>\n" + "<th class=\"table-sortable:numeric\" align=\"center\">#<br>Never<br>Taken</th>\n" + "<th class=\"table-sortable:numeric\" align=\"center\">Percent<br>Uncovered<br>Instructions</th>\n" + "<th class=\"table-sortable:numeric\" align=\"center\">Percent<br>Uncovered<br>Bytes</th>\n" "</tr>\n" "</thead>\n" "<tbody>\n", @@ -728,7 +728,7 @@ namespace Coverage { // Range fprintf( report, - "<td class=\"covoar-td\" align=\"center\"><a href =\"annotated.html#range%d\">%s </br>%s</td>\n", + "<td class=\"covoar-td\" align=\"center\"><a href =\"annotated.html#range%d\">%s <br>%s</td>\n", rangePtr->id, rangePtr->lowSourceLine.c_str(), rangePtr->highSourceLine.c_str() |