libtremor: merge part of upstream revision 17514 adding some limit checking for alloc...