Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

listpack over 8192 cause 'error: cursor out of range' panic error #24

Closed
freekatz opened this issue Sep 12, 2023 · 2 comments
Closed

listpack over 8192 cause 'error: cursor out of range' panic error #24

freekatz opened this issue Sep 12, 2023 · 2 comments

Comments

@freekatz
Copy link

Thanks for your awesome work! I found a bug when I test the rdb tool on my Mac about Redis7.2.

  • redis
redis-server -v                                          
Redis server v=7.2.1 sha=00000000:0 malloc=libc bits=64 build=7b8617dd94058f85
  • test data
redis-benchmark -c 1  --dbnum 0 -d 10000 -r 2000 -t rpush
  • code should be
         //  https://github.com/HDT3213/rdb/blob/887c2ca2556ffff3be967e74147ec5fe428af8b1/core/listpack.go#L105
	case 0: // 1111 0000 -> str, 4 bytes len
		var lenBytes []byte
		lenBytes, err = readBytes(buf, cursor, 4)
		if err != nil {
			return nil, 0, err
		}
		//strLen := int(binary.BigEndian.Uint32(lenBytes))
		strLen := int(binary.LittleEndian.Uint32(lenBytes))
		result, err := readBytes(buf, cursor, strLen)
		if err != nil {
			return nil, 0, err
		}
		//length = readVarInt(buf, cursor) // read element length
		length = uint32(len(result)) // read element length
		return result, length, nil
@freekatz freekatz changed the title listpack over 8192 cause '' panic error listpack over 8192 cause 'error: cursor out of range' panic error Sep 12, 2023
@rsgok
Copy link

rsgok commented Sep 16, 2023

run into the same panic error. has this change been tested?

@HDT3213
Copy link
Owner

HDT3213 commented Sep 17, 2023

Sorry for the late reply, this issue has been fixed in v1.0.13

@HDT3213 HDT3213 closed this as completed Sep 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants