google / google/pdl

Unexpected payload size for non byte aligned payload

Open
#32 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Rust
Stars
86
Forks
18
Avg merge
20h 49m
Merged PRs (30d)
1

Description

The following PDL file crashes `backends::rust::generate`, even though it passes through the analyzer:

```
little_endian_packets

struct Foo {
ts_sec: 20,
ts_usec: 32,
_size_(_payload_): 32,
_payload_,
}
```

Stack trace:

```
thread '' panicked at 'Unexpected payload size for non byte aligned payload', /home/mgeisler/src/pdl/src/backends/rust/parser.rs:526:17
stack backtrace:
0: begin_panic_handler
at /rustc/b2b34bd83192c3d16c88655158f7d8d612513e88/library/std/src/panicking.rs:593:5
1: panic_fmt
at /rustc/b2b34bd83192c3d16c88655158f7d8d612513e88/library/core/src/panicking.rs:67:14
2: pdl_compiler::backends::rust::parser::FieldParser::add_payload_field
at ./src/backends/rust/parser.rs:526:17
3: pdl_compiler::backends::rust::parser::FieldParser::add
at ./src/backends/rust/parser.rs:77:17
4: pdl_compiler::backends::rust::generate_data_struct
at ./src/backends/rust.rs:236:9
5: pdl_compiler::backends::rust::generate_struct_decl
at ./src/backends/rust.rs:696:38
6: pdl_compiler::backends::rust::generate_decl
at ./src/backends/rust.rs:979:13
7: pdl_compiler::backends::rust::generate::{{closure}}
at ./src/backends/rust.rs:998:53
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.