diff --git a/lib/postgrex/messages.ex b/lib/postgrex/messages.ex index 0f3ee018..b3c2a359 100644 --- a/lib/postgrex/messages.ex +++ b/lib/postgrex/messages.ex @@ -261,6 +261,10 @@ defmodule Postgrex.Messages do {first, data} = encode(msg) size = IO.iodata_length(data) + 4 + if size > 0xFFFFFFFF do + raise ArgumentError, "payload size #{size} exceeds maximum size of #{0xFFFFFFFF}" + end + if first do [first, <>, data] else