Skip to content

Segfault in rrd.Info() #14

Description

@ushis

Hello,

i was playing around with your rrd package and produced some segfaults using the rrd.Info() function with rrdtool 1.4.8.

Here is my sample program:

package main

import (
  "fmt"
  "os"
  "github.com/ziutek/rrd"
)

func main() {
  info, err := rrd.Info(os.Args[1])

  if err != nil {
    fmt.Println(err)
    os.Exit(1)
  }

  for k, v := range info {
    fmt.Println(k, ":", v)
  }
}

And the trace:

unexpected fault address 0x0
fatal error: fault
[signal 0xb code=0x80 addr=0x0 pc=0x42087a]

goroutine 1 [running]:
runtime.throw(0x781b57)
    /usr/lib/go/src/pkg/runtime/panic.c:464 +0x69 fp=0x7f686fd00c20
runtime.sigpanic()
    /usr/lib/go/src/pkg/runtime/os_linux.c:237 +0xe9 fp=0x7f686fd00c38
runtime.findnull(0x208d88000000000)
    /usr/lib/go/src/pkg/runtime/string.goc:22 +0x1a fp=0x7f686fd00c48
runtime.gostring(0x7f686fd00ca0, 0x208d88000000000)
    /usr/lib/go/src/pkg/runtime/string.goc:67 +0x27 fp=0x7f686fd00c80
github.com/ziutek/rrd._Cfunc_GoString(0x208d88000000000, 0x10, 0x0)
    github.com/ziutek/rrd/_obj/_cgo_defun.c:11 +0x31 fp=0x7f686fd00c98
github.com/ziutek/rrd.updateInfoValue(0x208d850, 0x0, 0x0, 0x8, 0x4e8580)
    /home/ushi/.go/src/github.com/ziutek/rrd/rrd_c.go:295 +0xd7 fp=0x7f686fd00d28
github.com/ziutek/rrd.parseRRDInfo(0x208d850, 0x0)
    /home/ushi/.go/src/github.com/ziutek/rrd/rrd_c.go:341 +0x477 fp=0x7f686fd00e08
github.com/ziutek/rrd.Info(0x7fff9e62c9cf, 0x8, 0x0, 0x0, 0x0)
    /home/ushi/.go/src/github.com/ziutek/rrd/rrd_c.go:408 +0xe4 fp=0x7f686fd00e38
main.main()
    /tmp/test.go:10 +0x52 fp=0x7f686fd00f48
runtime.main()
    /usr/lib/go/src/pkg/runtime/proc.c:220 +0x11f fp=0x7f686fd00fa0
runtime.goexit()
    /usr/lib/go/src/pkg/runtime/proc.c:1394 fp=0x7f686fd00fa8

goroutine 3 [syscall]:
runtime.goexit()
    /usr/lib/go/src/pkg/runtime/proc.c:1394
exit status 2

Tell me, if you need the rrd file or additional info. My first guess is, that the string is not properly 0 terminated, but it is just a guess.

Cheers, ushi

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions