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

Side by Side Diff: runtime/bin/dbg_connection.cc

Issue 12035086: Verify integrity of JSOM messages sent to debugger client (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 11 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/platform/json.h » ('j') | runtime/platform/json.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "bin/dbg_connection.h" 5 #include "bin/dbg_connection.h"
6 #include "bin/dbg_message.h" 6 #include "bin/dbg_message.h"
7 #include "bin/dartutils.h" 7 #include "bin/dartutils.h"
8 #include "bin/log.h" 8 #include "bin/log.h"
9 #include "bin/socket.h" 9 #include "bin/socket.h"
10 #include "bin/thread.h" 10 #include "bin/thread.h"
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 data_length_++; 133 data_length_++;
134 } 134 }
135 buf_[data_length_] = '\0'; 135 buf_[data_length_] = '\0';
136 ASSERT(data_length_ < buf_length_); 136 ASSERT(data_length_ < buf_length_);
137 } 137 }
138 } 138 }
139 139
140 140
141 static bool IsValidJSON(const char* msg) { 141 static bool IsValidJSON(const char* msg) {
142 dart::JSONReader r(msg); 142 dart::JSONReader r(msg);
143 return r.EndOfObject() != NULL; 143 return r.CheckMessage();
144 } 144 }
145 145
146 146
147 DebuggerConnectionHandler::DebuggerConnectionHandler(int debug_fd) 147 DebuggerConnectionHandler::DebuggerConnectionHandler(int debug_fd)
148 : debug_fd_(debug_fd), msgbuf_(NULL) { 148 : debug_fd_(debug_fd), msgbuf_(NULL) {
149 msgbuf_ = new MessageBuffer(debug_fd_); 149 msgbuf_ = new MessageBuffer(debug_fd_);
150 } 150 }
151 151
152 152
153 DebuggerConnectionHandler::~DebuggerConnectionHandler() { 153 DebuggerConnectionHandler::~DebuggerConnectionHandler() {
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 ASSERT(singleton_handler != NULL); 431 ASSERT(singleton_handler != NULL);
432 return singleton_handler; 432 return singleton_handler;
433 } 433 }
434 434
435 435
436 bool DebuggerConnectionHandler::IsConnected() { 436 bool DebuggerConnectionHandler::IsConnected() {
437 // TODO(asiva): Support multiple debugger connections. 437 // TODO(asiva): Support multiple debugger connections.
438 // Return true if a connection has been established. 438 // Return true if a connection has been established.
439 return singleton_handler != NULL; 439 return singleton_handler != NULL;
440 } 440 }
OLDNEW
« no previous file with comments | « no previous file | runtime/platform/json.h » ('j') | runtime/platform/json.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698