]> git.pld-linux.org Git - packages/qt4.git/blame - xmlpatterns_stack_overflow_fix.diff
- fix building with icu 59
[packages/qt4.git] / xmlpatterns_stack_overflow_fix.diff
CommitLineData
0b0e3709
AM
1commit d1b17740ed4d9b1e3c3ad5898bb8259969dc77df
2Author: Kamil Rojewski <kamil.rojewski@gmail.com>
3Date: Wed Aug 13 10:38:38 2014 +0200
4
5 fix for stack overflow
6
7 Recursion in item mapping iterator caused a stack
8 overflow for large datasets.
9
10 Task-number: QTBUG-40153
11 Change-Id: I693798de0ecfd3a920a3dd270172ce7ec3c13d8d
12 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
13
14Index: qt4-x11/src/xmlpatterns/iterators/qitemmappingiterator_p.h
15===================================================================
16--- qt4-x11.orig/src/xmlpatterns/iterators/qitemmappingiterator_p.h 2014-09-04 11:47:43.979391542 -0500
17+++ qt4-x11/src/xmlpatterns/iterators/qitemmappingiterator_p.h 2014-09-04 11:47:43.975391542 -0500
18@@ -117,24 +117,28 @@
19 */
20 virtual TResult next()
21 {
22- const TSource sourceItem(m_it->next());
23-
24- if(qIsForwardIteratorEnd(sourceItem))
25+ while (true)
26 {
27- m_current = TResult();
28- m_position = -1;
29- return TResult();
30- }
31- else
32- {
33- m_current = m_mapper->mapToItem(sourceItem, m_context);
34- if(qIsForwardIteratorEnd(m_current))
35- return next(); /* The mapper returned null, so continue with the next in the source. */
36- else
37+ const TSource &sourceItem = m_it->next();
38+ if (qIsForwardIteratorEnd(sourceItem))
39 {
40- ++m_position;
41+ m_current = TResult();
42+ m_position = -1;
43 return m_current;
44 }
45+ else
46+ {
47+ m_current = m_mapper->mapToItem(sourceItem, m_context);
48+ if (qIsForwardIteratorEnd(m_current))
49+ {
50+ continue; /* The mapper returned null, so continue with the next in the source. */
51+ }
52+ else
53+ {
54+ ++m_position;
55+ return m_current;
56+ }
57+ }
58 }
59 }
60
This page took 0.064113 seconds and 4 git commands to generate.