Fix bug where reusing a pklbinary#Renderer could result in incorrect output#1525
Fix bug where reusing a pklbinary#Renderer could result in incorrect output#1525HT154 merged 1 commit intoapple:mainfrom
pklbinary#Renderer could result in incorrect output#1525Conversation
pklbinary#Renderer could result in incorrect output
4e44e11 to
af2be45
Compare
|
Because this is stdlib code, there is only a single instance of In a server application, I’d hesitate to create a new packer for every call, but I’m not sure how much it matters here. If
|
I think the issue here is that |
|
Yes, that’s what I suspected. In that case, this looks fine to me. |
This code triggers the error condition (where the
b64scheme is implemented by a custom/external resource reader):The data dependency here is
dec.result.text -> read of dec.requestUri -> dec.encodedRequest -> dec.input -> enc.result.text -> read of enc.requestUri -> enc.inputWhen reusing the
MessagePacker, the read that is executed second (dec's) returns the result of the first read.I wasn't able to determine exactly why this happens, but it's obvious that the
messagePacker.clear()call isn't having the intended effect.Attempting to replace it with
messagePacker.reset(<new buffer>)did not help either.This is probably a negligible memory/perf hit in favor of correctness.