Skip to content

Tables with over 128 columns fail due to out of index range. #444

Description

@shiftcare-ian

Problem: greenmask dump panics when processing the settings table (129 columns). Greenmask's COPY format decoder uses a fixed [128] array internally. Any table with ≥129 columns causes an index-out-of-range panic. The crash happens because Greenmask still routes it through the COPY decoder even for untransformed tables.

panic: runtime error: index out of range [128] with length 128

goroutine 4819 [running]:
[github.com/greenmaskio/greenmask/internal/db/postgres/pgcopy.(*Row).Decode(0x28c86c1123c0](http://github.com/greenmaskio/greenmask/internal/db/postgres/pgcopy.(*Row).Decode(0x28c86c1123c0), {0x28c88317810f, 0x997, 0x998})
    /home/runner/work/greenmask/greenmask/internal/db/postgres/pgcopy/row.go:103 +0x3c8
[github.com/greenmaskio/greenmask/internal/db/postgres/dumpers.(*TransformationPipeline).Dump(0x28c86b40af60](http://github.com/greenmaskio/greenmask/internal/db/postgres/dumpers.(*TransformationPipeline).Dump(0x28c86b40af60), {0x125c0b8, 0x28c87bf48960}, {0x28c88317810f?, 0x0?, 0x0?})
    /home/runner/work/greenmask/greenmask/internal/db/postgres/dumpers/transformation_pipeline.go:160 +0x73
[github.com/greenmaskio/greenmask/internal/db/postgres/dumpers.(*TableDumper).process(0x28c87bbdd8f0](http://github.com/greenmaskio/greenmask/internal/db/postgres/dumpers.(*TableDumper).process(0x28c87bbdd8f0), {0x125c0b8, 0x28c87bf48960}, {0x12675e0?, 0x28c86beeb920?}, {0x7f76d097fa68?, 0x28c875f0b7e8?}, {0x125c520, 0x28c86b40af60})
    /home/runner/work/greenmask/greenmask/internal/db/postgres/dumpers/table.go:160 +0x466
[github.com/greenmaskio/greenmask/internal/db/postgres/dumpers.(*TableDumper).Execute.(*TableDumper).dumper.func2()](http://github.com/greenmaskio/greenmask/internal/db/postgres/dumpers.(*TableDumper).Execute.(*TableDumper).dumper.func2())
    /home/runner/work/greenmask/greenmask/internal/db/postgres/dumpers/table.go:89 +0x1a5
[golang.org/x/sync/errgroup.(*Group).Go.func1()](http://golang.org/x/sync/errgroup.(*Group).Go.func1())
    /home/runner/go/pkg/mod/golang.org/x/sync@v0.20.0/errgroup/errgroup.go:93 +0x50
created by [golang.org/x/sync/errgroup.(*Group).Go](http://golang.org/x/sync/errgroup.(*Group).Go) in goroutine 27
    /home/runner/go/pkg/mod/golang.org/x/sync@v0.20.0/errgroup/errgroup.go:78 +0x95

Metadata

Metadata

Assignees

Labels

help wantedExtra attention is neededv0.2Planned for v0.2.x version

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions