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

Unified Diff: chrome/browser/renderer_host/render_sandbox_host_linux.cc

Issue 507037: Returns an error immediately without sending IPC message when a font family n... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years 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
« no previous file with comments | « no previous file | skia/ext/SkFontHost_fontconfig_direct.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/renderer_host/render_sandbox_host_linux.cc
===================================================================
--- chrome/browser/renderer_host/render_sandbox_host_linux.cc (revision 34817)
+++ chrome/browser/renderer_host/render_sandbox_host_linux.cc (working copy)
@@ -100,11 +100,20 @@
void HandleRequestFromRenderer(int fd) {
std::vector<int> fds;
- static const unsigned kMaxMessageLength = 2048;
- char buf[kMaxMessageLength];
+
+ // A FontConfigIPC::METHOD_MATCH message could be kMaxFontFamilyLength
+ // bytes long (this is the largest message type).
+ // 128 bytes padding are necessary so recvmsg() does not return MSG_TRUNC
+ // error for a maximum length message.
+ char buf[FontConfigInterface::kMaxFontFamilyLength + 128];
+
const ssize_t len = base::RecvMsg(fd, buf, sizeof(buf), &fds);
- if (len == -1)
+ if (len == -1) {
+ // TODO: should send an error reply, or the sender might block forever.
+ NOTREACHED()
+ << "Sandbox host message is larger than kMaxFontFamilyLength";
return;
+ }
if (fds.size() == 0)
return;
« no previous file with comments | « no previous file | skia/ext/SkFontHost_fontconfig_direct.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698