Cleanup: forward declaration sorting.
[dcpomatic.git] / src / lib / encode_server.cc
index d326c767be226aa240255504354a4ae08a33ef75..036ea58a5df92b94cb5cde24e6a7666be195f3a4 100644 (file)
  */
 
 
-#include "encode_server.h"
-#include "util.h"
-#include "dcpomatic_socket.h"
-#include "image.h"
-#include "dcp_video.h"
+#include "compose.hpp"
 #include "config.h"
+#include "constants.h"
 #include "cross.h"
-#include "player_video.h"
-#include "compose.hpp"
-#include "log.h"
+#include "dcp_video.h"
 #include "dcpomatic_log.h"
+#include "dcpomatic_socket.h"
+#include "encode_server.h"
 #include "encoded_log_entry.h"
+#include "image.h"
+#include "log.h"
+#include "player_video.h"
 #include "version.h"
 #include <dcp/raw_convert.h>
 #include <dcp/warnings.h>
@@ -126,6 +126,10 @@ EncodeServer::process (shared_ptr<Socket> socket, struct timeval& after_read, st
        Socket::ReadDigestScope ds (socket);
 
        auto length = socket->read_uint32 ();
+       if (length > 65536) {
+               throw NetworkError("Malformed encode request (too large)");
+       }
+
        scoped_array<char> buffer (new char[length]);
        socket->read (reinterpret_cast<uint8_t*>(buffer.get()), length);