idada/v8.go — pull request #51 by mhrdev (2014-10-26 17:13:27+00:00)
Title: Fixed “utf8 length” bug.

Fixed memory error introduced in this commit: https://github.com/idada/v8.go/commit/ec0db45674de6f8a9383d252baee7146968d0dda
Added a test for this - here is a stacktrace (ubuntu) when the test is run without the fix:

````
=== RUN Test_Values
*** glibc detected *** /tmp/go-build580863650/github.com/mhrdev/v8.go/_test/v8.go.test: free(): invalid next size (fast): 0x00007f64d4002aa0 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x7eb96)[0x7f64def84b96]
/tmp/go-build580863650/github.com/mhrdev/v8.go/_test/v8.go.test[0x94be44]

[..]

SIGABRT: abort
PC=0x7f64def3c425
signal arrived during cgo execution

runtime.cgocall(0x588890, 0x7f64dff21b60)
/usr/local/go/src/pkg/runtime/cgocall.c:149 +0x11b fp=0x7f64dff21b48
github.com/mhrdev/v8%2ego._Cfunc_free(0x7f64d4002aa0)
github.com/mhrdev/v8.go/_test/_cgo_defun.c:1151 +0x31 fp=0x7f64dff21b60
github.com/mhrdev/v8%2ego.(*Value).ToString(0xc21000a780, 0xc24ff0, 0x1c)
/home/vagrant/go/v8.go/src/github.com/mhrdev/v8.go/v8_value.go:151 +0x60 fp=0x7f64dff21b98
github.com/mhrdev/v8%2ego.func·140(0xc2100530c0)
/home/vagrant/go/v8.go/src/github.com/mhrdev/v8.go/v8_value_test.go:80 +0xf54 fp=0x7f64dff21db0
github.com/mhrdev/v8%2ego.go_context_scope_callback(0xc2100530c0, 0xc2100000e0)
/home/vagrant/go/v8.go/src/github.com/mhrdev/v8.go/v8_context.go:65 +0x37 fp=0x7f64dff21dc0
[..]
````