This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug translator/7000] printf %n specifier causes segfault


------- Additional Comments From wenji dot huang at oracle dot com  2008-11-13 08:54 -------
Lack of checking bound in c_unparser::visit_print_format will cause the segment
fault. Seems this patch can avoid that.

diff --git a/translate.cxx b/translate.cxx
index 4112855..741455e 100644
--- a/translate.cxx
+++ b/translate.cxx
@@ -4199,7 +4199,7 @@ c_unparser::visit_print_format (print_format* e)
        /* The type of the %c argument is 'int'.  */
        else if (components[i].type == print_format::conv_char)
          o->line() << ", (int)" << tmp[arg_ix++].value();
-       else
+       else if (arg_ix < (int) tmp.size())
          o->line() << ", " << tmp[arg_ix++].value();
       }


-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=7000

------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]