Title: [216049] trunk
Revision
216049
Author
[email protected]
Date
2017-05-01 18:00:35 -0700 (Mon, 01 May 2017)

Log Message

Stop using sprintf() in _javascript_Core debugger
<https://webkit.org/b/171512>

Reviewed by Keith Miller.

Source/_javascript_Core:

* disassembler/udis86/udis86.c:
(ud_insn_hex): Switch from sprintf() to snprintf().

Tools:

* Scripts/webkitpy/style/checker.py:
(_PATH_RULES_SPECIFIER): Ignore some formatting checkers since
Source/_javascript_Core/disassembler/udis86/ is generated code.

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (216048 => 216049)


--- trunk/Source/_javascript_Core/ChangeLog	2017-05-02 00:51:18 UTC (rev 216048)
+++ trunk/Source/_javascript_Core/ChangeLog	2017-05-02 01:00:35 UTC (rev 216049)
@@ -1,3 +1,13 @@
+2017-05-01  David Kilzer  <[email protected]>
+
+        Stop using sprintf() in _javascript_Core debugger
+        <https://webkit.org/b/171512>
+
+        Reviewed by Keith Miller.
+
+        * disassembler/udis86/udis86.c:
+        (ud_insn_hex): Switch from sprintf() to snprintf().
+
 2017-04-21  Filip Pizlo  <[email protected]>
 
         Air::fixObviousSpills should remove totally redundant instructions

Modified: trunk/Source/_javascript_Core/disassembler/udis86/udis86.c (216048 => 216049)


--- trunk/Source/_javascript_Core/disassembler/udis86/udis86.c	2017-05-02 00:51:18 UTC (rev 216048)
+++ trunk/Source/_javascript_Core/disassembler/udis86/udis86.c	2017-05-02 01:00:35 UTC (rev 216049)
@@ -167,12 +167,12 @@
   if (!u->error) {
     unsigned int i;
     const unsigned char *src_ptr = ud_insn_ptr(u);
-    char* src_hex;
-    src_hex = (char*) u->insn_hexcode;
+    char* src_hex = (char*) u->insn_hexcode;
+    char* const src_hex_base = src_hex;
     /* for each byte used to decode instruction */
     for (i = 0; i < ud_insn_len(u) && i < sizeof(u->insn_hexcode) / 2;
          ++i, ++src_ptr) {
-      sprintf(src_hex, "%02x", *src_ptr & 0xFF);
+      snprintf(src_hex, sizeof(u->insn_hexcode) - (src_hex - src_hex_base), "%02x", *src_ptr & 0xFF);
       src_hex += 2;
     }
   }

Modified: trunk/Tools/ChangeLog (216048 => 216049)


--- trunk/Tools/ChangeLog	2017-05-02 00:51:18 UTC (rev 216048)
+++ trunk/Tools/ChangeLog	2017-05-02 01:00:35 UTC (rev 216049)
@@ -1,3 +1,14 @@
+2017-05-01  David Kilzer  <[email protected]>
+
+        Stop using sprintf() in _javascript_Core debugger
+        <https://webkit.org/b/171512>
+
+        Reviewed by Keith Miller.
+
+        * Scripts/webkitpy/style/checker.py:
+        (_PATH_RULES_SPECIFIER): Ignore some formatting checkers since
+        Source/_javascript_Core/disassembler/udis86/ is generated code.
+
 2017-05-01  Timothy Horton  <[email protected]>
 
         Expose viewport-fit instead of clip-to-safe-area

Modified: trunk/Tools/Scripts/webkitpy/style/checker.py (216048 => 216049)


--- trunk/Tools/Scripts/webkitpy/style/checker.py	2017-05-02 00:51:18 UTC (rev 216048)
+++ trunk/Tools/Scripts/webkitpy/style/checker.py	2017-05-02 01:00:35 UTC (rev 216049)
@@ -1,7 +1,7 @@
 # Copyright (C) 2009 Google Inc. All rights reserved.
 # Copyright (C) 2010 Chris Jerdonek ([email protected])
 # Copyright (C) 2010 ProFUSION embedded systems
-# Copyright (C) 2013, 2015 Apple Inc. All rights reserved.
+# Copyright (C) 2013-2017 Apple Inc. All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions are
@@ -231,6 +231,12 @@
       "+pep8/W291",  # Trailing white space
       "+whitespace/carriage_return"]),
 
+    ([# Source/_javascript_Core/disassembler/udis86/ is generated code.
+      os.path.join('Source', '_javascript_Core', 'disassembler', 'udis86')],
+     ["-readability/naming/underscores",
+      "-whitespace/declaration",
+      "-whitespace/indent"]),
+
     ([# There is no way to avoid the symbols __jit_debug_register_code
       # and __jit_debug_descriptor when integrating with gdb.
       os.path.join('Source', '_javascript_Core', 'jit', 'GDBInterface.cpp')],
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to