本站源代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
472B

  1. // +build gofuzz
  2. package toml
  3. func Fuzz(data []byte) int {
  4. tree, err := LoadBytes(data)
  5. if err != nil {
  6. if tree != nil {
  7. panic("tree must be nil if there is an error")
  8. }
  9. return 0
  10. }
  11. str, err := tree.ToTomlString()
  12. if err != nil {
  13. if str != "" {
  14. panic(`str must be "" if there is an error`)
  15. }
  16. panic(err)
  17. }
  18. tree, err = Load(str)
  19. if err != nil {
  20. if tree != nil {
  21. panic("tree must be nil if there is an error")
  22. }
  23. return 0
  24. }
  25. return 1
  26. }
上海开阖软件有限公司 沪ICP备12045867号-1