Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

erlcapnp cheats when encoding lists of text fields #3

Open
bucko909 opened this issue Jan 25, 2018 · 0 comments
Open

erlcapnp cheats when encoding lists of text fields #3

bucko909 opened this issue Jan 25, 2018 · 0 comments

Comments

@bucko909
Copy link
Owner

ast_encode_ptr(N, PtrLen0, #ptr_type{type=list, extra={text, TextType}}, VarName, Line) ->
    % This is a bit of a hack; we encode a list of text fields as a list of structs which have the first field being text.
    % They should really be anyPointer, I think, which doesn't need a header tag word.

This instructs to use ast_encode_struct_list_/3 to encode the text list.

Should really have an ast_encode_ptr_list_/1 which takes EncodeFun only.

That function should be functionally identical except that:

  • It should not add a tag word.
  • It should assume StructLen is 1 (each element of the list is just a single pointer).

There should also be a test to make sure this works.

@bucko909 bucko909 changed the title erlcapnp cheats when enoding lists of text fields erlcapnp cheats when encoding lists of text fields Jan 25, 2018
bucko909 added a commit that referenced this issue Apr 8, 2021
Without this, a `List(Text)` (which is `List(List(Int8))`) which is not
encodeded as `List(struct { x @0 :Text; })`, will decode the first text
pointer as a tag and get very wrong answers. The patch:

* Makes sure we give a sensible error for unsupported types.
* Provides better checking that data is correctly formatted.
* Also adds support for decoding `List(Text)` correctly, as well as
  decoding `List(struct {})` which was upgraded from `List(Int64)` or
  `List(AnyPointer)` (or compatible types).

We still don't support double lists.

This relates to Issue #3 (which relies on the upgrade decoding for its
`List(Text)` encoding to be valid).
bucko909 added a commit that referenced this issue Apr 8, 2021
Without this, a `List(Text)` (which is `List(List(Int8))`) which is not
encodeded as `List(struct { x @0 :Text; })`, will decode the first text
pointer as a tag and get very wrong answers. The patch:

* Makes sure we give a sensible error for unsupported types.
* Provides better checking that data is correctly formatted.
* Also adds support for decoding `List(Text)` correctly, as well as
  decoding `List(struct {})` which was upgraded from `List(Int64)` or
  `List(AnyPointer)` (or compatible types).

We still don't support double lists.

This relates to Issue #3 (which relies on the upgrade decoding for its
`List(Text)` encoding to be valid).
bucko909 added a commit that referenced this issue Apr 8, 2021
Without this, a `List(Text)` (which is `List(List(Int8))`) which is not
encodeded as `List(struct { x @0 :Text; })`, will decode the first text
pointer as a tag and get very wrong answers. The patch:

* Makes sure we give a sensible error for unsupported types.
* Provides better checking that data is correctly formatted.
* Also adds support for decoding `List(Text)` correctly, as well as
  decoding `List(struct {})` which was upgraded from `List(Int64)` or
  `List(AnyPointer)` (or compatible types).

We still don't support double lists.

This relates to Issue #3 (which relies on the upgrade decoding for its
`List(Text)` encoding to be valid).
bucko909 added a commit that referenced this issue Apr 9, 2021
Without this, a `List(Text)` (which is `List(List(Int8))`) which is not
encodeded as `List(struct { x @0 :Text; })`, will decode the first text
pointer as a tag and get very wrong answers. The patch:

* Makes sure we give a sensible error for unsupported types.
* Provides better checking that data is correctly formatted.
* Also adds support for decoding `List(Text)` correctly, as well as
  decoding `List(struct {})` which was upgraded from `List(Int64)` or
  `List(AnyPointer)` (or compatible types).

We still don't support double lists.

This relates to Issue #3 (which relies on the upgrade decoding for its
`List(Text)` encoding to be valid).
bucko909 added a commit that referenced this issue Apr 12, 2021
Without this, a `List(Text)` (which is `List(List(Int8))`) which is not
encodeded as `List(struct { x @0 :Text; })`, will decode the first text
pointer as a tag and get very wrong answers. The patch:

* Makes sure we give a sensible error for unsupported types.
* Provides better checking that data is correctly formatted.
* Also adds support for decoding `List(Text)` correctly, as well as
  decoding `List(struct {})` which was upgraded from `List(Int64)` or
  `List(AnyPointer)` (or compatible types).

We still don't support double lists.

This relates to Issue #3 (which relies on the upgrade decoding for its
`List(Text)` encoding to be valid).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant