public inbox for frysk@sourceware.org
 help / color / mirror / Atom feed
From: Petr Machata <pmachata@redhat.com>
To: frysk@sourceware.org
Subject: A minor bug in slurp
Date: Thu, 05 Apr 2007 15:50:00 -0000	[thread overview]
Message-ID: <46151AA8.4020401@redhat.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 1128 bytes --]

Hi list,

I found a minor bug in uslurp(int pid, const char* name).  It doesn't
append a NUL character.  MapsBuilder.construct then throws an exception:

Exception in thread "Thread-1" java.lang.RuntimeException: missing NUL
   at frysk.sys.proc.MapsBuilder.construct(fltrace)
   at frysk.sys.proc.MapsBuilder.construct(fltrace)
   at fltrace.updateAttached(fltrace)
   at frysk.proc.Task.notifyAttached(fltrace)
   at
frysk.proc.LinuxPtraceTaskState$Attached.transitionToRunningState(fltrace)
   at
frysk.proc.LinuxPtraceTaskState$StartMainTask$6.blockOrAttachContinue(fltrace)
   at
frysk.proc.LinuxPtraceTaskState$StartMainTask$6.handleTrappedEvent(fltrace)
   at frysk.proc.Task.processTrappedEvent(fltrace)
   at frysk.proc.LinuxPtraceHost$PollWaitOnSigChld$5.stopped(fltrace)
   at frysk.sys.Wait.waitAllNoHang(fltrace)
   at frysk.proc.LinuxPtraceHost$PollWaitOnSigChld.execute(fltrace)
   at frysk.event.EventLoop.runEventLoop(fltrace)
   at frysk.event.EventLoop.run(fltrace)

The attached patch fixes this problem, and introduces no regression.
(Tested against fresh checkout.)

Thanks,
PM

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: frysk-slurp-pid.patch --]
[-- Type: text/x-patch; name="frysk-slurp-pid.patch", Size: 429 bytes --]

diff -u -r1.1 slurp.cxx
--- frysk-imports/frysk/sys/proc/cni/slurp.cxx	8 Dec 2006 20:00:34 -0000	1.1
+++ frysk-imports/frysk/sys/proc/cni/slurp.cxx	5 Apr 2007 14:22:23 -0000
@@ -108,7 +108,7 @@
   ::close(fd);
 
   // Null terminate the buffer.
-  buf[current_offset] = '\0';
+  buf[current_offset++] = '\0';
 
   jbyteArray jbuf = JvNewByteArray (current_offset);
   ::memcpy (elements (jbuf), buf, current_offset);

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

             reply	other threads:[~2007-04-05 15:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-05 15:50 Petr Machata [this message]
2007-04-05 17:15 ` Petr Machata

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=46151AA8.4020401@redhat.com \
    --to=pmachata@redhat.com \
    --cc=frysk@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).