>What steps will reproduce the problem?
1. Update a router to use DD-WRT firmware (http://www.dd-wrt.com)
2. Build an application that uses upnpx.
3. Run the application that uses upnpx on a network segment where the router is
running DD-WRT firmware.
4. The application crashes in upnpx with the callstack:
#0 0x968e29c6 in __pthread_kill ()
#1 0x99d1df78 in pthread_kill ()
#2 0x02b8157b in abort ()
#3 0x003bc62b in uncaught_exception_handler ()
#4 0x0330e318 in __handleUncaughtException ()
#5 0x0274a0b9 in _objc_terminate ()
#6 0x02cffacd in safe_handler_caller(void (*)()) ()
#7 0x02cffacd in std::terminate() ()
#8 0x02d00bc2 in __cxa_throw ()
#9 0x02749f89 in objc_exception_throw ()
#10 0x03238b6a in -[__NSArrayM insertObject:atIndex:] ()
#11 0x03238a20 in -[__NSArrayM addObject:] ()
#12 0x003a346f in -[BasicDeviceParser embeddedDevice:] ()
#13 0x0275d6b0 in -[NSObject performSelector:withObject:] ()
#14 0x003a4898 in -[BasicParser
parser:didStartElement:namespaceRUI:qualifiedName:attributes:] ()
#15 0x0123a760 in _startElementNs ()
#16 0x006b8685 in xmlParseStartTag2 ()
#17 0x006ba4e5 in xmlParseTryOrFinish ()
#18 0x006b9f07 in xmlParseChunk ()
#19 0x01238e02 in -[NSXMLParser parse] ()
#20 0x003a46e4 in -[BasicParser startParser:] ()
#21 0x003a4650 in -[BasicParser parseFromURL:] ()
#22 0x003a3cc2 in -[BasicDeviceParser parse] ()
#23 0x003a70ea in -[BasicUPnPDevice loadDeviceDescriptionFromXML] ()
#24 0x003b5720 in -[UPnPDB httpThread:] ()
#25 0x011a5805 in -[NSThread main] ()
#26 0x011a5764 in __NSThread__main__ ()
#27 0x99d1bed9 in _pthread_start ()
>What is the expected output? What do you see instead?
The applicaiton should not crash.
>What version of the product are you using? On what operating system?
This has been confirmed to happen in iOS 5, 6 and 7, and Mac OS X 10.8 and 10.9.
>Please provide any additional information below.
It appears that the root device in the UPnP device description from DD-WRT does
not include a "friendlyName" element, and the code is expecting there to be one.
Here is a patch that fixes the problem:
Index: BasicDeviceParser.m
===================================================================
--- BasicDeviceParser.m (revision 37158)
+++ BasicDeviceParser.m (revision 37159)
@@ -263,7 +263,9 @@
-(void)embeddedDevice:(NSString*)startStop{
if([startStop isEqualToString:@"ElementStart"]){
- [friendlyNameStack addObject:friendlyName];
+ if(friendlyName){
+ [friendlyNameStack addObject:friendlyName];
+ }
[udnStack addObject:udn];
}else{
//Was this the device we are looking for ?
@@ -275,6 +277,7 @@
}
}
[self setUdn:[udnStack lastObject]];
+ // NOTE: friendlyName might be nil.
[self setFriendlyName:[friendlyNameStack lastObject]];
[friendlyNameStack removeLastObject];
Original issue reported on code.google.com by dbo...@logitech.com on 11 Dec 2013 at 9:12
Original issue reported on code.google.com by
dbo...@logitech.com
on 11 Dec 2013 at 9:12