Fix opml import crash
The opml parsing code handles cases where there are extra levels in the xml file by copying the child to the main container. This corrupts the source instance during the copy, which leads to corruption in the destination, and ultimately a crash when it is later used. To fix, do the copy in two steps, copying the child container to a temporary location before copying to the destination.
This commit is contained in:
parent
4e3e9c8d14
commit
fc4cb6fc7a
@ -279,8 +279,14 @@ bool PodcastParser::ParseOpml(QXmlStreamReader* reader,
|
||||
ParseOutline(reader, ret);
|
||||
|
||||
// OPML files sometimes consist of a single top level container.
|
||||
while (ret->feeds.count() == 0 && ret->containers.count() == 1) {
|
||||
*ret = ret->containers[0];
|
||||
OpmlContainer* top = ret;
|
||||
while (top->feeds.count() == 0 && top->containers.count() == 1) {
|
||||
top = &top->containers[0];
|
||||
}
|
||||
if (top != ret) {
|
||||
// Copy the sub-container to a temporary location first.
|
||||
OpmlContainer tmp = *top;
|
||||
*ret = tmp;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user