Skip to content

error: makeslice: len out of range #2

@qlel

Description

@qlel

Hello, I used the code in the example and replaced the path of the mdx file. After compilation, the following error occurred when I executed it:
你好,我使用示例中的代码,替换了mdx文件的路径,编译后执行出现了以下错误:

2025/08/31 22:20:12 Reading dictionary header: C:\a001\software\translate\精装_牛津高阶双解第10版完美版OALDPE\oaldpe.mdx
2025/08/31 22:20:12 Reading MDict header from file: C:\a001\software\translate\精装_牛津高阶双解第10版完美版OALDPE\oaldpe.mdx
2025/08/31 22:20:12 File 'C:\a001\software\translate\精装_牛津高阶双解第10版完美版OALDPE\oaldpe.mdx': Header length: 3496
2025/08/31 22:20:12 File 'C:\a001\software\translate\精装_牛津高阶双解第10版完美版OALDPE\oaldpe.mdx': Header adler32 checksum from file: 2422570338
2025/08/31 22:20:12 Verifying header checksum for 'C:\a001\software\translate\精装_牛津高阶双解第10版完美版OALDPE\oaldpe.mdx'. Expected: 2422570338
2025/08/31 22:20:12 Header checksum mismatch for 'C:\a001\software\translate\精装_牛津高阶双解第10版完美版OALDPE\oaldpe.mdx': expected 2422570338, calculated 3929050136
2025/08/31 22:20:12 Header checksum verification complete for: C:\a001\software\translate\精装_牛津高阶双解第10版完美版OALDPE\oaldpe.mdx
2025/08/31 22:20:12 Parsing header XML info for: C:\a001\software\translate\精装_牛津高阶双解第10版完美版OALDPE\oaldpe.mdx
2025/08/31 22:20:12 Header info parsed for 'C:\a001\software\translate\精装_牛津高阶双解第10版完美版OALDPE\oaldpe.mdx'. Title: 'OALDPE En-Cn 精装版 V2025.02.14', EngineVersion: '2.0', Encoding: ''
2025/08/31 22:20:12 Mdict version for 'C:\a001\software\translate\精装_牛津高阶双解第10版完美版OALDPE\oaldpe.mdx': 2.0
2025/08/31 22:20:12 Reading key block metadata: C:\a001\software\translate\精装_牛津高阶双解第10版完美版OALDPE\oaldpe.mdx
2025/08/31 22:20:12 Key block metadata read settings for 'C:\a001\software\translate\精装_牛津高阶双解第10版完美版OALDPE\oaldpe.mdx'. Version: 2.0, NumberWidth: 8, KeyBlockMetaStartOffset: 3504
2025/08/31 22:20:12 Key block metadata is encrypted (type 2) for 'C:\a001\software\translate\精装_牛津高阶双解第10版完美版OALDPE\oaldpe.mdx', decrypting...
2025/08/31 22:20:12 Key block metadata decryption complete for: C:\a001\software\translate\精装_牛津高阶双解第10版完美版OALDPE\oaldpe.mdx
2025/08/31 22:20:12 Reading key block info: C:\a001\software\translate\精装_牛津高阶双解第10版完美版OALDPE\oaldpe.mdx
2025/08/31 22:20:12 Reading key block info from offset 3548, size 8315089439096014408 for 'C:\a001\software\translate\精装_牛津高阶双解第10版完美版OALDPE\oaldpe.mdx'
panic: runtime error: makeslice: len out of range

goroutine 1 [running]:
mdx.readFileFromPos(0xc00018c018, 0x5?, 0x736521ca24eb8648)
        C:/a001/learn/exp_go_2022/mdict_web/mdx/util.go:123 +0x3e
mdx.(*MdictBase).readKeyBlockInfo(0xc0001a0000)
        C:/a001/learn/exp_go_2022/mdict_web/mdx/mdict_base.go:306 +0x347
mdx.(*Mdict).BuildIndex(0xc00019e000)
        C:/a001/learn/exp_go_2022/mdict_web/mdx/mdict.go:75 +0x1f
main.main()
        C:/a001/learn/exp_go_2022/mdict_web/app/mdict_web.go:19 +0x85

File DL: oaldpe.mdx

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