<html>
<head>
<base href="http://bugzilla.gdcproject.org/" />
</head>
<body><span class="vcard"><a class="email" href="mailto:p.remmers@arcor.de" title="Peter Remmers <p.remmers@arcor.de>"> <span class="fn">Peter Remmers</span></a>
</span> changed
<a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED INVALID - String literals not always properly zero-terminated"
href="http://bugzilla.gdcproject.org/show_bug.cgi?id=91">bug 91</a>
<br>
<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>What</th>
<th>Removed</th>
<th>Added</th>
</tr>
<tr>
<td style="text-align:right;">CC</td>
<td>
</td>
<td>p.remmers@arcor.de
</td>
</tr></table>
<p>
<div>
<b><a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED INVALID - String literals not always properly zero-terminated"
href="http://bugzilla.gdcproject.org/show_bug.cgi?id=91#c6">Comment # 6</a>
on <a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED INVALID - String literals not always properly zero-terminated"
href="http://bugzilla.gdcproject.org/show_bug.cgi?id=91">bug 91</a>
from <span class="vcard"><a class="email" href="mailto:p.remmers@arcor.de" title="Peter Remmers <p.remmers@arcor.de>"> <span class="fn">Peter Remmers</span></a>
</span></b>
<pre>I must add that I also just stumbled upon this. I was about to file another bug
but then found this.
I think string literals should always be zero terminated, not just when used as
a parameter to a function that takes a char*.
Here is a quote from std/string.d (the toStringz() function):
* Note that the compiler will put a 0 past the end of static
* strings, and the storage allocator will put a 0 past the end
* of newly allocated char[]'s.
This little test program works on DMD and LDC2, but fails on GDC:
int main(string[] argv)
{
string s = "Hello"; // same with static string s = "Hello";
assert(*(s.ptr + s.length - 1) == 'o'); // OK
assert(*(s.ptr + s.length) == '\0'); // fails
return 0;
}
I think it's a bug.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are watching all bug changes.</li>
</ul>
</body>
</html>