fix: prevent error.OutOfMemory when filtering very large messages
This commit is contained in:
parent
b4a37c9eb3
commit
2590a1ac11
1 changed files with 4 additions and 1 deletions
|
@ -121,7 +121,10 @@ pub const List = struct {
|
|||
}
|
||||
|
||||
pub fn filter(self: *const List, from: tp.pid_ref, m: tp.message) error{Exit}!bool {
|
||||
var buf: [tp.max_message_size]u8 = undefined;
|
||||
var sfa = std.heap.stackFallback(4096, self.a);
|
||||
const a = sfa.get();
|
||||
const buf = a.alloc(u8, m.buf.len) catch |e| return tp.exit_error(e);
|
||||
defer a.free(buf);
|
||||
@memcpy(buf[0..m.buf.len], m.buf);
|
||||
const m_: tp.message = .{ .buf = buf[0..m.buf.len] };
|
||||
var e: ?error{Exit} = null;
|
||||
|
|
Loading…
Add table
Reference in a new issue