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

Unified Diff: ppapi/host/error_conversion.cc

Issue 16959005: Implement PPB_UDPSocket_Dev: part 2 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: In response to Cris's suggestions: not using base::ListValue; check conversoin in NetErrorToPepperE… Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ppapi/host/error_conversion.cc
diff --git a/ppapi/host/error_conversion.cc b/ppapi/host/error_conversion.cc
index e84c7e5d4ecc4427575dcc164a5d0320906e5c8c..f7e5ea530edb24888d430be6e105b01a16a9b179 100644
--- a/ppapi/host/error_conversion.cc
+++ b/ppapi/host/error_conversion.cc
@@ -4,6 +4,9 @@
#include "ppapi/host/error_conversion.h"
+#include <limits>
+
+#include "base/logging.h"
#include "net/base/net_errors.h"
#include "ppapi/c/pp_errors.h"
@@ -11,8 +14,10 @@ namespace ppapi {
namespace host {
int32_t NetErrorToPepperError(int net_error) {
- if (net_error > 0)
+ if (net_error > 0) {
+ CHECK_LE(net_error, std::numeric_limits<int32_t>::max());
bbudge 2013/06/18 14:54:37 Should we crash the browser process? Why not use b
yzshen1 2013/06/18 16:39:16 I think it should be fine, because having a positi
return static_cast<int32_t>(net_error);
+ }
switch (net_error) {
case net::OK:

Powered by Google App Engine
This is Rietveld 408576698