Why is it unsafe ? Imagine that the memory become invalid (the original stack is destroyed...) it would only trigger SEH. The only unsafe things would be an overwrite of the stack but even malloc can't prevent overwrite.
Le jeudi 20 avril 2017 00:56:40 UTC+2, Fedor Indutny a écrit : > > Hm... perhaps my comment wasn't stated as clear as it could be. > > This is *definitely* unsafe, you'll run into problems with this code > eventually. > > On Wed, Apr 19, 2017 at 6:53 PM, Florent Cabret <[email protected] > <javascript:>> wrote: > >> Its not that easy I think gcc use main thread stack as memory (as you can >> see with the little memcpy coded as rep movsd). >> Moreover I don't need to worry about free at all. >> >> Le jeudi 20 avril 2017 00:50:31 UTC+2, Fedor Indutny a écrit : >>> >>> This sounds unsafe and dangerous. I wouldn't recommend running this code >>> anywhere at all. >>> >>> On Wed, Apr 19, 2017 at 6:47 PM, Florent Cabret <[email protected]> >>> wrote: >>> >>>> Actually I find a dirty trick to use the stack xD >>>> >>>> Le mardi 18 avril 2017 22:13:03 UTC+2, Thiago Arruda a écrit : >>>>> >>>>> It is not a matter or initializing uv_tcp_t before uv_run, the problem >>>>> is you passing stack-allocated on a function that is itself invoked by >>>>> libuv. >>>>> >>>>> On Tue, Apr 18, 2017 at 5:01 PM Florent Cabret <[email protected]> >>>>> wrote: >>>>> >>>>>> You mean uv_connect_t ? because I understand from you answer than I >>>>>> must do uv_tcp_init before uv_run. >>>>>> >>>>>> >>>>>> Le mardi 18 avril 2017 21:59:27 UTC+2, Thiago Arruda a écrit : >>>>>> >>>>>>> I can see you are still allocating things on the stack via callbacks >>>>>>> invoked by libuv(line 43), that will never work >>>>>>> >>>>>>> On Tue, Apr 18, 2017 at 4:54 PM Florent Cabret <[email protected]> >>>>>>> wrote: >>>>>>> >>>>>> Still doesn't work after the advice provided by Fedor and Thiago. >>>>>>>> >>>>>>>> >>>>>>>> Le mardi 18 avril 2017 19:27:03 UTC+2, Florent Cabret a écrit : >>>>>>>>> >>>>>>>>> Hi, >>>>>>>>> >>>>>>>>> I dont know what is wrong with my code but it trigger a memory >>>>>>>>> exception in uv_process_tcp_connect_req at line req->cb(req, >>>>>>>>> uv_translate_sys_error(err)); where it call a random address. >>>>>>>>> >>>>>>>> -- >>>>>>>> You received this message because you are subscribed to the Google >>>>>>>> Groups "libuv" group. >>>>>>>> >>>>>>> To unsubscribe from this group and stop receiving emails from it, >>>>>>>> send an email to [email protected]. >>>>>>>> To post to this group, send email to [email protected]. >>>>>>> >>>>>>> >>>>>>>> Visit this group at https://groups.google.com/group/libuv. >>>>>>>> For more options, visit https://groups.google.com/d/optout. >>>>>>>> >>>>>>> -- >>>>>> You received this message because you are subscribed to the Google >>>>>> Groups "libuv" group. >>>>>> To unsubscribe from this group and stop receiving emails from it, >>>>>> send an email to [email protected]. >>>>>> To post to this group, send email to [email protected]. >>>>>> Visit this group at https://groups.google.com/group/libuv. >>>>>> For more options, visit https://groups.google.com/d/optout. >>>>>> >>>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "libuv" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to [email protected]. >>>> To post to this group, send email to [email protected]. >>>> Visit this group at https://groups.google.com/group/libuv. >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> >>> > -- You received this message because you are subscribed to the Google Groups "libuv" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/libuv. For more options, visit https://groups.google.com/d/optout.
