[PATCH] D112782: [LNT] Fixed possible crash or junk data in cPerf

Pavel Kosov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 29 03:28:07 PDT 2021


This revision was automatically updated to reflect the committed changes.
Closed by commit rLNT5d5836721d48:  [LNT] Fixed possible crash or junk data in cPerf (authored by kpdev42).

Repository:
  rLNT LNT

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D112782/new/

https://reviews.llvm.org/D112782

Files:
  lnt/testing/profile/cPerf.cpp


Index: lnt/testing/profile/cPerf.cpp
===================================================================
--- lnt/testing/profile/cPerf.cpp
+++ lnt/testing/profile/cPerf.cpp
@@ -365,6 +365,7 @@
 
   void reset(Map *M, uint64_t Start, uint64_t Stop) {
     ThisAddress = 0;
+    ThisText = "";
     if (Stream) {
       fclose(Stream);
       wait(NULL);
@@ -396,6 +397,7 @@
       ssize_t Len = getline(&Line, &LineLen, Stream);
       if (Len == -1) {
         ThisAddress = EndAddress;
+        ThisText = "";
         return;
       }
       char *TokBuf;
@@ -757,10 +759,9 @@
     uint64_t Adjust) {
   ObjdumpOutput Dump(Objdump, BinaryCacheRoot);
   Dump.reset(&M, Sym.Start, Sym.End);
-  Dump.next();
 
   emitFunctionStart(Sym.Name);
-  for (uint64_t I = Sym.Start; I < Sym.End; I = Dump.next()) {
+  for (uint64_t I = Dump.next(); I < Sym.End; I = Dump.next()) {
     auto PC = Event->first - Adjust;
 
     auto Text = Dump.getText();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D112782.383289.patch
Type: text/x-patch
Size: 944 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211029/7a89d8ff/attachment.bin>


More information about the llvm-commits mailing list