Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Open return error failed to read dir: readInfo failed: buffer too small #2

@patryk4815

Description

@patryk4815

Calling erofs.EroFS(r).Open("/lib/debug/.build-id/3e/ad060eb79d854a2033f5bb41cc09785c9fb50c.debug") returns error:
failed to read dir: readInfo failed: buffer too small

Error is coming from:

	layout := uint8((format & 0x0E) >> 1)
	if format&0x01 == 0 {
		var inode disk.InodeCompact
		if _, err := binary.Decode(ino[:disk.SizeInodeCompact], binary.LittleEndian, &inode); err != nil {
			return nil, err // <- ERR is return from here
		}

Probably bug is with sizes?

  • ino[:disk.SizeInodeCompact] is size 0x20
  • structdisk.InodeCompact sizeof is 0x24

My erofs is compiled with this command:
cat 4gb.tar | mkfs.erofs --tar=f --quiet -Enoinline_data out.erofs

My erofs (4GB) is too big for upload to share.

Some logs:

$ mkfs.erofs --version
mkfs.erofs (erofs-utils) 1.8.6
available compressors: lz4, lz4hc, lzma, deflate, libdeflate, zstd

$ dump.erofs -s /tmp/out/erofs
Filesystem magic number:                      0xE0F5E1E2
Filesystem blocksize:                         4096
Filesystem blocks:                            715554
Filesystem inode metadata start block:        0
Filesystem shared xattr metadata start block: 0
Filesystem root nid:                          36
Filesystem lz4_max_distance:                  0
Filesystem sb_size:                           128
Filesystem inode count:                       219
Filesystem created:                           Thu Oct 30 02:57:00 2025
Filesystem features:                          sb_csum mtime
Filesystem UUID:                              7b7e8712-4885-4d20-9438-01958447e0e5

$ dump.erofs --ls --path=/lib/debug/.build-id/3e/ /tmp/out.erofs
Path : /lib/debug/.build-id/3e
Size: 265  On-disk size: 265  directory
NID: 351   Links: 2   Layout: 2   Compression ratio: 100.00%
Inode size: 64   Xattr size: 0
Uid: 0   Gid: 0  Access: 0444/r--r--r--
Timestamp: 1970-01-01 00:00:00.000000000

       NID TYPE  FILENAME
       351    2  .
        82    2  ..
   1094605    1  ad060eb79d854a2033f5bb41cc09785c9fb50c.debug
   1094607    7  ad060eb79d854a2033f5bb41cc09785c9fb50c.executable
   1094612    7  ad060eb79d854a2033f5bb41cc09785c9fb50c.source
   1094616    7  ad060eb79d854a2033f5bb41cc09785c9fb50c.sourceoverlay

$ dump.erofs -e --nid=1094605 /tmp/out.erofs
Path : /lib/debug/.build-id/3e/ad060eb79d854a2033f5bb41cc09785c9fb50c.debug
Size: 971275880  On-disk size: 971275880  regular file
NID: 1094605   Links: 1   Layout: 0   Compression ratio: 100.00%
Inode size: 64   Xattr size: 0
Uid: 0   Gid: 0  Access: 0555/r-xr-xr-x
Timestamp: 1970-01-01 00:00:00.000000000

 Ext:   logical offset   |  length :     physical offset    |  length
   0:        0..971276288 | 971276288 :  500572160..1471848448 | 971276288
/lib/debug/.build-id/3e/ad060eb79d854a2033f5bb41cc09785c9fb50c.debug: 1 extents found

Dumped ino variable:

2025/10/30 03:42:28 ReadAt 'offset': 0x480
2025/10/30 03:42:28 ReadAt 'ino': "\x04\x00\x00\x00\xffA\x04\x009\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00$\x00\x00\x00\x00\x00\x00\x000\x00\x02\x00$\x00\x00\x00\x00\x00\x00\x001\x00\x02\x00'\x00\x00\x00\x00\x00\x00\x003\x00\x02\x00+\x00\x00\x00\x00\x00\x00\x006\x00\x02\x00...libsrc\x00\x00\x00\x00\x00\x00\x00\x05\x00\x00\x00$A\x00\x00,\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'\x00\x00\x00\x00\x00\x00\x00$\x00\x02\x00$\x00\x00\x00\x00\x00\x00\x00%\x00\x02\x00/\x00\x00\x00\x00\x00\x00\x00'\x00\x02\x00...debug\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05\x00\x00\x00$A\x00\x00.\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00+\x00\x00\x00\x00\x00\x00\x00$\x00\x02\x00$\x00\x00\x00\x00\x00\x00\x00%\x00\x02\x00\x0fPt\x05\x00\x00\x00\x00'\x00\x02\x00...overlay\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05\x00\x00\x00$A\x00\x00\x06\x04\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00/\x00\x00\x00\x00\x00\x00\x00\xe0\x01\x02\x00'\x00\x00\x00\x00\x00\x00\x00\xe1\x01\x02\x00R\x00\x00\x00\x00\x00\x00\x00\xe3\x01\x02\x00b\x00\x00\x00\x00\x00\x00\x00\xec\x01\a\x00f\x00\x00\x00\x00\x00\x00\x00\xf7\x01\a\x00j\x00\x00\x00\x00\x00\x00\x00\xfe\x01\a\x00n\x00\x00\x00\x00\x00\x00\x00\x06\x02\a\x00r\x00\x00\x00\x00\x00\x00\x00\x1e\x02\a\x00v\x00\x00\x00\x00\x00\x00\x004\x02\a\x00z\x00\x00\x00\x00\x00\x00\x00?\x02\a\x00\x80\x00\x00\x00\x00\x00\x00\x00G\x02\a\x00\x84\x00\x00\x00\x00\x00\x00\x00P\x02\a\x00\x88\x00\x00\x00\x00\x00\x00\x00Y\x02\a\x00\x8c\x00\x00\x00\x00\x00\x00\x00m\x02\a\x00\x90\x00\x00\x00\x00\x00\x00\x00y\x02\a\x00\x94\x00\x00\x00\x00\x00\x00\x00\x8e\x02\a\x00\x98\x00\x00\x00\x00\x00\x00\x00\xa1\x02\a\x00\x9c\x00\x00\x00\x00\x00\x00\x00\xb1\x02\a\x00\xa0\x00\x00\x00\x00\x00\x00\x00\xc5\x02\a\x00\xa4\x00\x00\x00\x00\x00\x00\x00\xcf\x02\a\x00\xa8\x00\x00\x00\x00\x00\x00\x00\xe3\x02\a\x00\xac\x00\x00\x00\x00\x00\x00\x00\xf8\x02\a\x00\xb0\x00\x00\x00\x00\x00\x00\x00\x0e\x03\a\x00\xb4\x00\x00\x00\x00\x00\x00\x00\x19\x03\a\x00\xb8\x00\x00\x00\x00\x00\x00\x00'\x03\a\x00\xbc\x00\x00\x00\x00\x00\x00\x00;\x03\a\x00\xc0\x00\x00\x00\x00\x00\x00\x00E\x03\a\x00\xc4\x00\x00\x00\x00\x00\x00\x00T\x03\a\x00\xc8\x00\x00\x00\x00\x00\x00\x00e\x03\a\x00\xcc\x00\x00\x00\x00\x00\x00\x00q\x03\a\x00\xd0\x00\x00\x00\x00\x00\x00\x00{\x03\a\x00\xd4\x00\x00\x00\x00\x00\x00\x00\x9a\x03\a\x00\xd8\x00\x00\x00\x00\x00\x00\x00\xa0\x03\a\x00\xdc\x00\x00\x00\x00\x00\x00\x00\xa8\x03\a\x00\xe0\x00\x00\x00\x00\x00\x00\x00\xb8\x03\a\x00\xe4\x00\x00\x00\x00\x00\x00\x00\xcc\x03\a\x00\xe8\x00\x00\x00\x00\x00\x00\x00\xde\x03\a\x00\xec\x00\x00\x00\x00\x00\x00\x00\xe8\x03\a\x00\xf0\x00\x00\x00\x00\x00\x00\x00\xf2\x03\a\x00\xf4\x00\x00\x00\x00\x00\x00\x00\xfe\x03\a\x00....build-idamdgpu-archclang++clang-21clang-apply-replacementsclang-change-namespaceclang-checkclang-clclang-cppclang-docclang-extdef-mappingclang-formatclang-include-cleanerclang-include-fixerclang-installapiclang-linker-wrapperclang-moveclang-nvlink-wrapperclang-offload-bundlerclang-offload-packagerclang-queryclang-refactorclang-reorder-fieldsclang-replclang-scan-depsclang-sycl-linkerclang-tblgenclang-tidyclang-tidy-confusable-chars-genclangddiagtoolfind-all-symbolslibclang-cpp.so.21.1libclang.so.21.1.2modularizenvptx-archoffload-archpp-trace\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05\x00\x00\x00$A\x00\x00\xbf\x01\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00R\x00\x00\x00\x00\x00\x00\x00\x80\x01\x02\x00/\x00\x00\x00\x00\x00\x00\x00\x81\x01\x02\x00\x00\x01\x00\x00\x00\x00\x00\x00\x83\x01\x02\x00\v\x01\x00\x00\x00\x00\x00\x00\x85\x01\x02\x00\x16\x01\x00\x00\x00\x00\x00\x00\x87\x01\x02\x00!\x01\x00\x00\x00\x00\x00\x00\x89\x01\x02\x00,\x01\x00\x00\x00\x00\x00\x00\x8b\x01\x02\x007\x01\x00\x00\x00\x00\x00\x00\x8d\x01\x02\x00B\x01\x00\x00\x00\x00\x00\x00\x8f\x01\x02\x00M\x01\x00\x00\x00\x00\x00\x00\x91\x01\x02\x00_\x01\x00\x00\x00\x00\x00\x00\x93\x01\x02\x00j\x01\x00\x00\x00\x00\x00\x00\x95\x01\x02\x00u\x01\x00\x00\x00\x00\x00\x00\x97\x01\x02\x00\x80\x01\x00\x00\x00\x00\x00\x00\x99\x01\x02\x00\x8b\x01\x00\x00\x00\x00\x00\x00\x9b\x01\x02\x00\x96\x01\x00\x00\x00\x00\x00\x00\x9d\x01\x02\x00\xa1\x01\x00\x00\x00\x00\x00\x00\x9f\x01\x02\x00\xac\x01\x00\x00\x00\x00\x00\x00\xa1\x01\x02\x00\xb7\x01\x00\x00\x00\x00\x00\x00\xa3\x01\x02\x00\xc2\x01\x00\x00\x00\x00\x00\x00\xa5\x01\x02\x00\xcd\x01\x00\x00\x00\x00\x00\x00\xa7\x01\x02\x00\xd8\x01\x00\x00\x00\x00\x00\x00\xa9\x01\x02\x00\xe3\x01\x00\x00\x00\x00\x00\x00\xab\x01\x02\x00\xee\x01\x00\x00\x00\x00\x00\x00\xad\x01\x02\x00\x00\x02\x00\x00\x00\x00\x00\x00\xaf\x01\x02\x00\x12\x02\x00\x00\x00\x00\x00\x00\xb1\x01\x02\x00\x1d\x02\x00\x00\x00\x00\x00\x00\xb3\x01\x02\x00(\x02\x00\x00\x00\x00\x00\x00\xb5\x01\x02\x003\x02\x00\x00\x00\x00\x00\x00\xb7\x01\x02\x00>\x02\x00\x00\x00\x00\x00\x00\xb9\x01\x02\x00I\x02\x00\x00\x00\x00\x00\x00\xbb\x01\x02\x00T\x02\x00\x00\x00\x00\x00\x00\xbd\x01\x02\x00...05131415192f3b3d3e3f5152545f63666e727a7d7f848d99a4b1d0d2effb\x00\x05\x00\x00\x00$\xa1\x00\x009\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\x06\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00.build-id/ef/f465dbc7db40903a1adf8b589a8d6100414787.debug\x00\x00\x00\x00\x00\x00\x00\x05\x00\x00\x00$\xa1\x00\x009\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00.build-id/8d/7e9dc7c6331518dd69f90215bb1693fc24f21c.debug\x00\x00\x00\x00\x00\x00\x00\x05\x00\x00\x00$\xa1\x00\x009\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00.build-id/8d/7e9dc7c6331518dd69f90215bb1693fc24f21c.debug\x00\x00\x00\x00\x00\x00\x00\x05\x00\x00\x00$\xa1\x00\x009\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\t\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00.build-id/3b/5fba49971bd66a5ac502cb6900323820a137e9.debug\x00\x00\x00\x00\x00\x00\x00\x05\x00\x00\x00$\xa1\x00\x009\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\n\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00.build-id/6e/a30a184c74a6f8d1ca90d645878e32c1579339.debug\x00\x00\x00\x00\x00\x00\x00\x05\x00\x00\x00$\xa1\x00\x009\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\v\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00.build-id/fb/46a9462ea147267fc3148896deb10c141ab10f.debug\x00\x00\x00\x00\x00\x00\x00\x05\x00\x00\x00$\xa1\x00\x009\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00.build-id/8d/7e9dc7c6331518dd69f90215bb1693fc24f21c.debug\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00m\x81\x00\x00Б4\x00\x00\x00\x00\x00\x05\x00\x00\x00I\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"

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