-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
udp.cc中对接收数据的处理出现异常 #10
Comments
看了相关的代码,并没有发现buf.addSize在处理rn=0的逻辑有问题。你能否提供重现问题的例子呢? |
@yedf 昨晚找了一下出问题的情况,我这边使用udp-svr/udp-cli进行测试收发,问题在于下面makeRoom和space执行的顺序:
深究的话似乎是参数压栈顺序从右向左,而space方法依赖makeRoom,就是先调用space的话返回0 延伸:你那边没有问题吗?并且UDP允许发送0字节的数据,rn=0的话就会出现释放内存错误 使用库的makefile编译的:
|
我原先的代码直接调用space是有问题的,你的修复方式是可行的,已经修复为 |
👍 |
释放内存错误
*** Error in
./udp-cli': double free or corruption (top): 0x0000000000f555e0 ***`顺带问一下,什么情况下recvfrom返回0? 设定了非阻塞模式?我抓包看一下发送端
The text was updated successfully, but these errors were encountered: