Question about Linker.Option.isTrivial()
Pedro Lamarão
pedro.lamarao at prodist.com.br
Mon Jan 15 17:27:11 UTC 2024
Em seg., 15 de jan. de 2024 às 12:57, Maurizio Cimadamore <
maurizio.cimadamore at oracle.com> escreveu:
> On 15/01/2024 15:23, 刘希晨 wrote:
>
> For example, in
> https://www.postgresql.org/docs/current/protocol-message-formats.html
> <https://urldefense.com/v3/__https://www.postgresql.org/docs/current/protocol-message-formats.html__;!!ACWV5N9M2RV99hQ!MyEp6roAVJiCW7ICOb0qsj7sTbl0-6FMpSP_cUorkgFXlpYaIVusJQFoY7eOtiEupFUi3lUU5xivRt9F_QCYn96J52eW$>,
> the postgresql startup message contains a length prefix indicates the total
> length, while within the message body, multiple string were represented as
> key-value pair, so we need to call MemorySegment.getString() multiple times
> to retrieve them, and we must care about the offset value here.
>
> Thus I think it's quite useful to have a getStringBytes() API in
> memorySegment, it would be needed and constantly used.
>
> Thanks for the pointer. It is indeed a case of "back to back" strings.
>
> One possible workaround, with current API, is to simply get the string
> first, then get the string bytes (and that would be your "next offset").
>
I think that a validating parser for such protocols must scan for the
sentinel value before decoding the variable length element to avoid
decoding invalid messages.
--
Pedro Lamarão
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/panama-dev/attachments/20240115/1dd08348/attachment-0001.htm>
More information about the panama-dev
mailing list