Wireshark-bugs: [Wireshark-bugs] [Bug 4461] Lua ByteArray:append() causes wireshark crash
Date: Wed, 18 Jan 2012 20:03:12 -0800 (PST)
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=4461

Tony Trinh <tony19@xxxxxxxxx> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tony19@xxxxxxxxx

--- Comment #9 from Tony Trinh <tony19@xxxxxxxxx> 2012-01-18 20:03:11 PST ---
A workaround is to use ByteArray.new(). For example, to prepend ByteArray B to
ByteArray A: 

    local C = ByteArray.new( tostring(B)..tostring(A) )

In this case, if you need to repeatedly append/prepend bytes (e.g., in a loop),
it's more efficient to manipulate string representations, and then create the
ByteArray with the resulting string. 

    math.randomseed( os.time() )
    local hexstr = ""
    for i=1,100 do
        hexstr = hexstr .. string.format( '%02x', math.random()*100 )
    end

    local b = ByteArray.new(hexstr)

-- 
Configure bugmail: https://bugs.wireshark.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are watching all bug changes.