[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #53148] NULL characters not processed correctl
From: |
Rik |
Subject: |
[Octave-bug-tracker] [bug #53148] NULL characters not processed correctly in *printf() family of functions |
Date: |
Tue, 13 Feb 2018 17:23:02 -0500 (EST) |
User-agent: |
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0 |
URL:
<http://savannah.gnu.org/bugs/?53148>
Summary: NULL characters not processed correctly in *printf()
family of functions
Project: GNU Octave
Submitted by: rik5
Submitted on: Tue 13 Feb 2018 02:23:00 PM PST
Category: Octave Function
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Matlab Compatibility
Status: Confirmed
Assigned to: None
Originator Name:
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release: dev
Operating System: Any
_______________________________________________________
Details:
NULL characters in the format string of a printf() function terminate the
string. This was discovered with sprintf(). For example,
s = sprintf ("B\0B")
s = B
double (s)
ans = 66
This doesn't look magically easy to fix. For sprintf() an octave_ostrstream
object is created (see Fsprintf in file-io.cc) which eventually calls the
method str() to return a string object. Looking in octave-stream.cc this is
calling std::ostringstream::str().
Perhaps the stream can be opened in binary format at the beginning, but I
don't know what effect that will have on ordinary text sequences like "\n".
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?53148>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Octave-bug-tracker] [bug #53148] NULL characters not processed correctly in *printf() family of functions,
Rik <=