Commit Graph

459 Commits

Author SHA1 Message Date
Vasily Romanov 8ef38d7618 upd test version 2024-12-14 21:16:31 +03:00
Vasily Romanov c2f6bad9b5 Merge pull request #405 from IakovLeven/patch-1
Fix Unmarshaler interface description
2024-12-14 20:58:47 +03:00
Vasily Romanov d48874ae4a Merge pull request #381 from niallnsec/master
Copy byte array when unmarshalling RawMessage
2024-12-14 20:58:31 +03:00
IakovLeven 46715aab06 Fix Unmarshaler interface description 2024-11-21 10:22:44 +03:00
Niall Newman 34d2f3ad1a Only add tags to run command if set 2024-01-28 19:13:32 +00:00
Vasily Romanov 141f9c7d7f Merge pull request #393 from iamtakingiteasy/master
Make current token kind public and accessible via Lexer.CurrentToken
2024-01-09 14:12:31 +03:00
Alexander Tumin 3bd36b7ac9 Make current token kind public and accessible via Lexer.CurrentToken
Updated implementation of #308
2024-01-06 18:17:55 +03:00
Niall Newman 573107bd9e Copy byte array when unmarshalling RawMessage 2022-12-08 15:54:08 +00:00
Erik Dubbelboer a209843d8e Fix bytesToStr (#358)
The current implementation of bytesToStr uses an unsafe
reflect.StringHeader value. Change the implementation of this function
to a safe and simpler version.

To explain what could go wrong here is some example code:

  var d []byte
  d = someFunctionThatReturnsBytes()

  s := bytesToStr(d)

  doSomethingWith(s)

When this code gets compiled bytesToStr would get inlined and the
code would be like the following. I have included in comments at which
point things could go wrong:

  var d []byte
  d = someFunctionThatReturnsBytes()

  h := (*reflect.SliceHeader)(unsafe.Pointer(&d))
  shdr := reflect.StringHeader{Data: h.Data, Len: h.Len}

  // At this point in time d and d.Data have nothing referencing them anymore
  // shdr.Data is an uintptr so it will be ignored by the GC.
  // This means d and d.Data can be garbage collected here.
  // Internally strings don't use a uintptr for the data, but since this is
  // just a reflect.StringHeader and not a real string yet that doesn't apply
  // here.
  // This is why https://pkg.go.dev/unsafe#Pointer says:
  //   In general, reflect.SliceHeader and reflect.StringHeader should be
  //   used only as *reflect.SliceHeader and *reflect.StringHeader pointing
  //   at actual slices or strings, never as plain structs.

  s := *(*string)(unsafe.Pointer(&shdr))

  // Only at this point s.Data points to d.Data again and the backing storage
  // of d won't be garbage collected anymore.

  doSomethingWith(s)

The chance of this going wrong is probably so small that nobody ever
noticed it happening, but it is there.
2022-04-04 11:41:36 +03:00
bulletmys 11c9d7f52f fix Readme 2021-10-10 23:36:00 +03:00
Dmitry Rybakov 605adaeee3 Merge pull request #352 from bulletmys/upd_ci
added Github Actions CI instead of Travis CI
2021-10-10 23:22:51 +03:00
bulletmys 42b87bff63 upd readme and delete .travis.yml 2021-10-10 23:14:44 +03:00
bulletmys 738f356010 fix run-on-arch-action actions 2021-10-10 22:55:02 +03:00
bulletmys 309f1b66b9 add non amd64 actions 2021-10-10 21:05:35 +03:00
bulletmys 5fd7585ed4 upd github actions 2021-10-10 20:46:21 +03:00
bulletmys 3c100a79a3 upd github actions 2021-10-10 20:24:20 +03:00
bulletmys 7c1e3c1c97 upd github actions 2021-10-10 20:22:25 +03:00
bulletmys 4f5f962fb8 add github actions 2021-10-10 20:12:06 +03:00
bulletmys 52ae64103b fix allocs expectations in tests 2021-10-10 19:42:20 +03:00
dmitry.rybakov eecedd19f7 add simple example to README and upd install cmd 2021-09-27 00:08:55 +03:00
Dmitry Rybakov e57b4c6a1c Merge pull request #338 from MQasimSarfraz/patch-1
Fix typo in README.md
2021-09-12 22:27:47 +03:00
Dmitry Rybakov 7653026585 Merge pull request #342 from denis96z/master
Fix too many arguments in call to MarshalJSON
2021-09-12 22:13:39 +03:00
Denis Zinovyev e33cca903c fix too many arguments in call to MarshalJSON 2021-06-15 21:44:37 +03:00
Qasim Sarfraz 0c17714265 Fix type in README.md 2021-05-07 00:51:56 +02:00
santosh653 c120ca7ced Update .travis.yml (#324)
Adding power support.
2021-02-06 22:00:08 +03:00