<html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px"><div id="yui_3_16_0_1_1440037331513_19600">Looked at this again and I can't seem to induce an error or crash.  But I also cannot understand how gp_w can be used to reliably refer to an element in a dynamically allocated byte array.</div><div id="yui_3_16_0_1_1440037331513_19602"><br></div><div id="yui_3_16_0_1_1440037331513_19604">Doesn't this stackoverflow discussion apply here?</div><div id="yui_3_16_0_1_1440037331513_19582"><a id="yui_3_16_0_1_1440037331513_19580" href="http://stackoverflow.com/questions/2172127/how-to-update-other-pointers-when-realloc-moves-the-memory-block">http://stackoverflow.com/questions/2172127/how-to-update-other-pointers-when-realloc-moves-the-memory-block</a></div><div id="yui_3_16_0_1_1440037331513_19606"><br></div><div id="yui_3_16_0_1_1440037331513_19608">Thanks,</div><div id="yui_3_16_0_1_1440037331513_19620">Jonathan<br></div><div id="yui_3_16_0_1_1440037331513_18114"><span></span></div>  <br><div class="qtdSeparateBR"><br><br></div><div style="display: block;" class="yahoo_quoted"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;"> <div dir="ltr"> <font face="Arial" size="2"> On Wednesday, August 19, 2015 11:33 AM, Jonathan Wilkes via Pd-list <pd-list@lists.iem.at> wrote:<br> </font> </div>  <br><br> <div class="y_msg_container"><div id="yiv6003090206"><div><div style="color:#000;background-color:#fff;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px;"><div id="yiv6003090206yui_3_16_0_1_1439997494934_4697">Hi list,</div><div id="yiv6003090206yui_3_16_0_1_1439997494934_4697">So I'm looking at t_gpointer in m_pd.h, and I'm noticing that for arrays it has gp_w which is a union _word pointer.  This is the raw data that I was asking about in my previous request for a free lesson. :)</div><div id="yiv6003090206yui_3_16_0_1_1439997494934_4697"><br></div><div id="yiv6003090206yui_3_16_0_1_1439997494934_4697">However, in the code for [setsize] the data is resized dynamically using realloc.</div><div id="yiv6003090206yui_3_16_0_1_1439997494934_4697"><br></div><div id="yiv6003090206yui_3_16_0_1_1439997494934_4697">So...</div><div id="yiv6003090206yui_3_16_0_1_1439997494934_4697"><br></div><div id="yiv6003090206yui_3_16_0_1_1439997494934_4697" dir="ltr">Suppose I have a [pointer] in a patch which is pointing to a nested array, and a [setsize] which is pointing to the container array.  If I send an enormous float to [setsize], isn't it likely that realloc will move the data and my [pointer] data will silently become stale?  After all, gp_w has no idea if realloc moves the data.  Seems like it'd be pointing to the wrong place and likely to cause a crash.</div><div id="yiv6003090206yui_3_16_0_1_1439997494934_4697"><br></div><div id="yiv6003090206yui_3_16_0_1_1439997494934_4697" dir="ltr">I don't have access to a running Pd instance atm, otherwise I'd test...</div><div id="yiv6003090206yui_3_16_0_1_1439997494934_4697" dir="ltr"><br></div><div id="yiv6003090206yui_3_16_0_1_1439997494934_4697" dir="ltr">Thanks,</div><div id="yiv6003090206yui_3_16_0_1_1439997494934_4697" dir="ltr">Jonathan</div><div id="yiv6003090206yui_3_16_0_1_1439997494934_4697"><br></div><div id="yiv6003090206yui_3_16_0_1_1439997494934_4697"><br></div></div></div></div><br>_______________________________________________<br><a ymailto="mailto:Pd-list@lists.iem.at" href="mailto:Pd-list@lists.iem.at">Pd-list@lists.iem.at</a> mailing list<br>UNSUBSCRIBE and account-management -> <a href="http://lists.puredata.info/listinfo/pd-list" target="_blank">http://lists.puredata.info/listinfo/pd-list</a><br><br><br></div>  </div> </div>  </div></div></body></html>