<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jul 13, 2015 at 3:46 PM, Linus Torvalds <span dir="ltr"><<a href="mailto:torvalds@linux-foundation.org" target="_blank">torvalds@linux-foundation.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Sat, Jul 11, 2015 at 4:39 PM, Linus Torvalds<br>
<<a href="mailto:torvalds@linux-foundation.org">torvalds@linux-foundation.org</a>> wrote:<br>
><br>
> which is just the taxonomy.category writes. Looks like it writes past<br>
> the end of the allocation.<br>
<br>
</span>Ok, looking at this, the problem seems to be pretty clear.<br>
<br>
When the code does the taxonomy lookup in<br>
ReverseGeoLookupThread::run(), it keeps on just adding data to the<br>
taxonomy field.<br>
<br>
IOW, the code that overflows the allocation is this, which just keeps doing:<br>
<br>
                                if (ds->taxonomy.category == NULL)<br>
                                        ds->taxonomy.category =<br>
alloc_taxonomy();<br>
<br>
ds->taxonomy.category[ds-><a href="http://taxonomy.nr" rel="noreferrer" target="_blank">taxonomy.nr</a>].category = TC_OCEAN;<br>
<br>
ds->taxonomy.category[ds-><a href="http://taxonomy.nr" rel="noreferrer" target="_blank">taxonomy.nr</a>].origin = taxonomy::GEOCODED;<br>
<br>
ds->taxonomy.category[ds-><a href="http://taxonomy.nr" rel="noreferrer" target="_blank">taxonomy.nr</a>].value =<br>
copy_string(qPrintable(oceanName["name"].toString()));<br>
                                ds-><a href="http://taxonomy.nr" rel="noreferrer" target="_blank">taxonomy.nr</a>++;<br>
<br>
and eventually "ds-><a href="http://taxonomy.nr" rel="noreferrer" target="_blank">taxonomy.nr</a>" will grow past TC_NR_CATEGORIES and<br>
we corrupt memory.<br>
<br>
I don't know exactly how it happens, though.  Normally I would expect that the<br>
<br>
                                ds-><a href="http://taxonomy.nr" rel="noreferrer" target="_blank">taxonomy.nr</a> = ri;<br>
<br>
that happens a bit earlier would reset the taxonomy number to 0 or 1,<br>
but that is all inside that<br>
<br>
                        if (geoNames.count() > 0) {<br>
<br>
conditional, so maybe there is some situation where that doesn't<br>
happen, and then the later code ends up adding too many entries<br>
because it keeps adding things on top of older data.<br>
<br>
I don't know the code. It looks like both Tomaz started it and Dirk<br>
has been changing code in this area, soo..<br></blockquote><div><br></div><div>Actually, it's all dirk's code. I moved  around when I created a thread so it wouldn't freeze my machine.<br></div><div>I'll t ake a look on it as soon as I have some time. just finished a big piece of the UI for Location Management<br> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class="HOEnZb"><font color="#888888"><br>
               Linus<br>
</font></span></blockquote></div><br></div></div>