public inbox for frysk@sourceware.org
 help / color / mirror / Atom feed
* A minor bug in slurp
@ 2007-04-05 15:50 Petr Machata
  2007-04-05 17:15 ` Petr Machata
  0 siblings, 1 reply; 2+ messages in thread
From: Petr Machata @ 2007-04-05 15:50 UTC (permalink / raw)
  To: frysk


[-- 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 --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: A minor bug in slurp
  2007-04-05 15:50 A minor bug in slurp Petr Machata
@ 2007-04-05 17:15 ` Petr Machata
  0 siblings, 0 replies; 2+ messages in thread
From: Petr Machata @ 2007-04-05 17:15 UTC (permalink / raw)
  To: Petr Machata; +Cc: frysk

[-- Attachment #1: Type: text/plain, Size: 307 bytes --]

Petr Machata wrote:
> 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:

Hm, there is probably a better place for reporting bugs:
http://sourceware.org/bugzilla/show_bug.cgi?id=4324

PM


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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-04-05 17:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-05 15:50 A minor bug in slurp Petr Machata
2007-04-05 17:15 ` Petr Machata

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).