Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000352libmpdclientpublic2005-01-18 07:562005-03-07 20:19
Reporternormalperson 
Assigned Toshank 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformipodlinuxOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0000352: libmpdclient segfaults over very slow links when reading large lists
Descriptionmpd (uclinux port) is running on my ipod, mpc is running on my desktop machine.
telnet works fine.

commands that list large lists like mpc listall and mpc playlist cause problems when a large amount of data is being read.
mpc status/play/stop/prev and other short commands work fine.

Since it's difficult to reproduce, I may be the only one having this problem, so I guess I'll fix it; but just to let you know...


Steps To Reproducerun mpd on your ipod, mpc on a desktop machine connected to the ipod over ip-over-firewire.

telnet and netcat work fine.
Additional InformationBacktrace with GDB (from mpc trunk (r2878)):

#0 0x4009a793 in strchr () from /lib/libc.so.6
(gdb) bt
#0 0x4009a793 in strchr () from /lib/libc.so.6
#1 0x08049b46 in mpd_getNextReturnElement (connection=0x8053d78) at libmpdclient.c:403
#2 0x0804b190 in mpd_getNextInfoEntity (connection=0x8053d78) at libmpdclient.c:958
#3 0x0804ffc8 in cmd_listall (argc=0, argv=0x8053d68, conn=0x8053d78) at command.c:549
#4 0x0804d133 in main (argc=0, argv=0xbffff2c4) at main.c:223
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0000383)
normalperson (administrator)
2005-01-18 10:48

bufferCheck was pointing in the wrong place.

OK, looks like I fixed it. This works for me on both fast and slow connections.

I'm not entirely sure about the logic behind the original implementation, or why it managed to work on fast connections but it's after 1am and my brain was never great with aritmetic, either.


--- orig/src/libmpdclient.c
+++ mod/src/libmpdclient.c
@@ -419,7 +419,6 @@
                        connection->doneListOk = 0;
                        return;
                }
- bufferCheck+=connection->buflen-connection->bufstart;
                tv.tv_sec = connection->timeout.tv_sec;
                tv.tv_usec = connection->timeout.tv_usec;
                FD_ZERO(&fds);
@@ -440,6 +439,7 @@
                                connection->doneListOk = 0;
                                return;
                        }
+ bufferCheck = connection->buffer + connection->buflen;
                        connection->buflen+=readed;
                        connection->buffer[connection->buflen] = '\0';
                }
(0000385)
shank (administrator)
2005-01-23 04:51

this bug is happens when less then one line of input is read by read(). Then bufferCheck is incorrectly computed and can potentially cause a segfault or other nastiness.

- Issue History
Date Modified Username Field Change
2005-01-18 07:56 normalperson New Issue
2005-01-18 10:48 normalperson Note Added: 0000383
2005-01-23 04:51 shank Status assigned => resolved
2005-01-23 04:51 shank Resolution open => fixed
2005-01-23 04:51 shank Note Added: 0000385
2005-03-07 20:19 Avuton Olrich Status resolved => closed


Copyright © 2000 - 2010 MantisBT Group
Powered by Mantis Bugtracker