<div dir="ltr">Thanks, Victor!</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Dec 4, 2013 at 6:39 AM, Victor Julien <span dir="ltr"><<a href="mailto:victor@inliniac.net" target="_blank">victor@inliniac.net</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On 12/04/2013 01:17 PM, Chris Wakelin wrote:<br>
> On 04/12/13 12:16, Victor Julien wrote:<br>
>> On 12/04/2013 01:13 PM, Victor Julien wrote:<br>
>>> On 12/04/2013 12:56 PM, Victor Julien wrote:<br>
>>>> On 12/04/2013 12:37 PM, Chris Wakelin wrote:<br>
>>>>>> [32578] 4/12/2013 -- 11:18:50 - (detect-luajit.c:281) <Info> (DetectLuajitMatchBuffer) -- failed to run script: not enough memory<br>
>>>>> I guess we could add more checks to the Lua scripts to avoid the<br>
>>>>> zlib/xor errors, which occur all the time, but I think they're probably<br>
>>>>> not significant. Is there a way we could prevent or at least debug the<br>
>>>>> "not enough memory" errors which are presumably what causes Suricata to<br>
>>>>> crash?<br>
>>>><br>
>>>> Maybe you can try inserting a "return 0" on line 282, so:<br>
>>>><br>
>>>>     int retval = lua_pcall(tluajit->luastate, 1, 1, 0);<br>
>>>>     if (retval != 0) {<br>
>>>>         SCLogInfo("failed to run script: %s",<br>
>>>> lua_tostring(tluajit->luastate, -1));<br>
>>>>         return 0;<br>
>>>>     }<br>
>>>><br>
>>><br>
>>> Actually, please ignore this. I found that the lua state isn't cleared<br>
>>> properly, will send a test patch in a few minutes.<br>
>>><br>
>><br>
>> Can you try the attached patch?<br>
<br>
</div>I have pushed an lua update to the master. It should fix the issue some<br>
people were seeing "(DetectLuajitMatch) -- failed to run script: stack<br>
overflow". Hopefully it also addresses Chris' issue.<br>
<br>
Other than that, there was a fix to how flowvars were retrieved. In<br>
short, if the stored value was not a multiple of 4, the length was wrong.<br>
<br>
Finally, you can now get the gid, sid and rev from the rule calling the<br>
script:<br>
<br>
function match(args)<br>
    a = SCRuleSid<br>
    b = SCRuleRev<br>
    c = SCRuleGid<br>
    print (a .. " " .. b .. " " .. c)<br>
end<br>
<br>
Please test :)<br>
<div class="im HOEnZb"><br>
--<br>
---------------------------------------------<br>
Victor Julien<br>
<a href="http://www.inliniac.net/" target="_blank">http://www.inliniac.net/</a><br>
PGP: <a href="http://www.inliniac.net/victorjulien.asc" target="_blank">http://www.inliniac.net/victorjulien.asc</a><br>
---------------------------------------------<br>
<br>
</div><div class="HOEnZb"><div class="h5">_______________________________________________<br>
Suricata IDS Devel mailing list: <a href="mailto:oisf-devel@openinfosecfoundation.org">oisf-devel@openinfosecfoundation.org</a><br>
Site: <a href="http://suricata-ids.org" target="_blank">http://suricata-ids.org</a> | Participate: <a href="http://suricata-ids.org/participate/" target="_blank">http://suricata-ids.org/participate/</a><br>
List: <a href="https://lists.openinfosecfoundation.org/mailman/listinfo/oisf-devel" target="_blank">https://lists.openinfosecfoundation.org/mailman/listinfo/oisf-devel</a><br>
Redmine: <a href="https://redmine.openinfosecfoundation.org/" target="_blank">https://redmine.openinfosecfoundation.org/</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr">Kyle Creyts<br><br>Information Assurance Professional<br>Founder BSidesDetroit</div>
</div>