Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(101)

Issue 23777003: Second attempt at introducing SafeSPrintf(). (Closed)

Created:
7 years, 3 months ago by Markus (顧孟勤)
Modified:
7 years ago
CC:
chromium-reviews, erikwright+watch_chromium.org, jshin+watch_chromium.org, do-not-use
Visibility:
Public.

Description

Second attempt at introducing SafeSPrintf(). See original discussion at https://codereview.chromium.org/18656004/ Reverted as: https://codereview.chromium.org/23463010/ Added a new base::strings::SafeSPrintf() function that can safely be called from all restricted (e.g. async-signal-safe) environments. It is roughly equivalent to snprintf(). But it is easier to use, as it uses C++ to be type-safe. In release builds, this function is guaranteed to never call any other library function nor any system calls. In debug builds, we call RAW_CHECK() in some circumstances. This code is needed for (at least) the seccomp sandbox and to clean up code in the stack tracer. Those changes are pending and will be submitted as separate CLs. BUG=285499 TEST=base_unittests TBR=willchan@chromium.org NOTRY=true Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=221322

Patch Set 1 #

Patch Set 2 : Add some debugging output #

Patch Set 3 : Collecting more data #

Patch Set 4 : cros_daisy doesn't define __unix__. Try to get the definition for OS_POSIX and then test for that s… #

Patch Set 5 : Relax tests for NULL #

Patch Set 6 : Added missing braces (style-change only) #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1889 lines, -0 lines) Patch
M base/base.gyp View 1 chunk +1 line, -0 lines 0 comments Download
M base/base.gypi View 1 chunk +2 lines, -0 lines 0 comments Download
A base/strings/OWNERS View 1 chunk +1 line, -0 lines 0 comments Download
A base/strings/safe_sprintf.h View 1 2 3 4 1 chunk +441 lines, -0 lines 0 comments Download
A base/strings/safe_sprintf.cc View 1 2 3 4 5 1 chunk +681 lines, -0 lines 0 comments Download
A base/strings/safe_sprintf_unittest.cc View 1 chunk +763 lines, -0 lines 0 comments Download

Messages

Total messages: 8 (0 generated)
jln (very slow on Chromium)
lgtm
7 years, 3 months ago (2013-09-05 00:27:57 UTC) #1
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/markus@chromium.org/23777003/23001
7 years, 3 months ago (2013-09-05 00:41:26 UTC) #2
commit-bot: I haz the power
Change committed as 221322
7 years, 3 months ago (2013-09-05 00:43:53 UTC) #3
Nico
Hello, I'm not a fan of the C++11-specific things in this CL. We don't really ...
7 years ago (2013-12-05 21:15:22 UTC) #4
willchan no longer on Chromium
Yes, it's fine to remove. That said, I'm surprised it's adding a maintenance cost. Is ...
7 years ago (2013-12-05 21:27:29 UTC) #5
Nico
On Thu, Dec 5, 2013 at 1:27 PM, <willchan@chromium.org> wrote: > Yes, it's fine to ...
7 years ago (2013-12-05 21:31:00 UTC) #6
willchan no longer on Chromium
Sorry, I was misleading. Yeah, I understand why it's a maintenance cost. But I don't ...
7 years ago (2013-12-05 21:34:08 UTC) #7
Nico
7 years ago (2013-12-05 21:36:31 UTC) #8
On Thu, Dec 5, 2013 at 1:34 PM, <willchan@chromium.org> wrote:

> Sorry, I was misleading. Yeah, I understand why it's a maintenance cost.
> But I
> don't understand why it broke. Is it gcc's fault?
>

I don't know if gcc is right rejecting this or clang is right accepting it.
The compile error is at https://codereview.chromium.org/107173002/#msg1


>
> And yeah, let's go ahead and kill this code if it's causing problems.
>
> https://chromiumcodereview.appspot.com/23777003/
>

To unsubscribe from this group and stop receiving emails from it, send an email
to chromium-reviews+unsubscribe@chromium.org.

Powered by Google App Engine
This is Rietveld 408576698