Skip to content

[Bug] go 1.22 编译程序运行报错,panic: encoding alphabet includes duplicate symbols #469

@poneding

Description

@poneding

使用 go1.22 版本编译 openrasp 程序运行将报错:

image

这是因为go 1.22版本中 base64.NewEncoding 函数对入参增加了新的验证:不可重复字符,参考:encoding: require unique alphabet for base32 and base64

源码定位OPQRSTYZabcdefgABCDEFGHIJKLMNhijklmnopqrUVWXstuvwxyz01234567891q 包含重复字符 1 和 q,所以 程序运行至此会直接 panic。

建议调整为使用 base64.StdEncoding.EncodeToString 函数。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions