Skip to content

fix(opcua): handle ua.ByteArray in variant array decoding#18825

Open
wucm667 wants to merge 1 commit intoinfluxdata:masterfrom
wucm667:fix/opcua-bytearray-decode
Open

fix(opcua): handle ua.ByteArray in variant array decoding#18825
wucm667 wants to merge 1 commit intoinfluxdata:masterfrom
wucm667:fix/opcua-bytearray-decode

Conversation

@wucm667
Copy link
Copy Markdown

@wucm667 wucm667 commented Apr 30, 2026

Summary

When decoding OPC UA variant arrays, the plugin crashes when encountering ua.ByteArray values because the decoder does not handle this specific type. This fix adds proper handling for ua.ByteArray in the variant array decoding logic, preventing the crash.

Checklist

Related issues

resolves #18824

The type switch in the OPC UA input plugin was missing a case for
ua.ByteArray, which is a named type (type ByteArray []byte) in the
gopcua library. Go's type switch does not match named types against
their underlying types, causing ByteArray values to fall through to
the default error case.

Add a case for ua.ByteArray that converts to []byte for proper
unpacking.

Fixes influxdata#18824
@telegraf-tiger
Copy link
Copy Markdown
Contributor

Thanks so much for the pull request!
🤝 ✒️ Just a reminder that the CLA has not yet been signed, and we'll need it before merging. Please sign the CLA when you get a chance, then post a comment here saying !signed-cla

@telegraf-tiger telegraf-tiger Bot added the fix pr to fix corresponding bug label Apr 30, 2026
@telegraf-tiger
Copy link
Copy Markdown
Contributor

@wucm667
Copy link
Copy Markdown
Author

wucm667 commented Apr 30, 2026

!signed-cla

@srebhan
Copy link
Copy Markdown
Member

srebhan commented Apr 30, 2026

@wucm667 please restore the PR description template, especially the AI section! Otherwise we cannot review your contribution...

@srebhan srebhan self-assigned this Apr 30, 2026
@wucm667
Copy link
Copy Markdown
Author

wucm667 commented Apr 30, 2026

Done, restored the template and filled in the checklist. Thanks for the reminder!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix pr to fix corresponding bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

inputs.opcua: cannot decode VariantType=Byte arrays (ua.ByteArray)

2 participants