summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
authorMichi Henning <michi@zeroc.com>2006-06-27 06:06:05 +0000
committerMichi Henning <michi@zeroc.com>2006-06-27 06:06:05 +0000
commit13ce9ce43ee0b4618a0c23c02560c35ba82efb8c (patch)
tree85e55ba50d513efe37fa4649ba219fca0ff2f43f /cpp
parentBug 710. (diff)
downloadice-13ce9ce43ee0b4618a0c23c02560c35ba82efb8c.tar.bz2
ice-13ce9ce43ee0b4618a0c23c02560c35ba82efb8c.tar.xz
ice-13ce9ce43ee0b4618a0c23c02560c35ba82efb8c.zip
Bug 966.
Diffstat (limited to 'cpp')
-rw-r--r--cpp/src/Slice/Scanner.l8
-rw-r--r--cpp/test/Slice/errorDetection/ConstDef.err2
-rw-r--r--cpp/test/Slice/errorDetection/ConstDef.ice3
3 files changed, 13 insertions, 0 deletions
diff --git a/cpp/src/Slice/Scanner.l b/cpp/src/Slice/Scanner.l
index d212f82439d..cdad5358273 100644
--- a/cpp/src/Slice/Scanner.l
+++ b/cpp/src/Slice/Scanner.l
@@ -277,6 +277,10 @@ floating_literal (({fractional_constant}{exponent_part}?)|((\+|-)?[[:digit:]]+{e
{
unput(next);
}
+ if(us == 0)
+ {
+ unit->error("illegal NUL character in string constant");
+ }
str->v += static_cast<char>(us);
break;
}
@@ -300,6 +304,10 @@ floating_literal (({fractional_constant}{exponent_part}?)|((\+|-)?[[:digit:]]+{e
}
}
unput(next);
+ if(ull == 0)
+ {
+ unit->error("illegal NUL character in string constant");
+ }
str->v += static_cast<char>(ull);
break;
}
diff --git a/cpp/test/Slice/errorDetection/ConstDef.err b/cpp/test/Slice/errorDetection/ConstDef.err
index 7f8d198b784..01ab3ae9938 100644
--- a/cpp/test/Slice/errorDetection/ConstDef.err
+++ b/cpp/test/Slice/errorDetection/ConstDef.err
@@ -19,3 +19,5 @@ ConstDef.ice:119: initializer `-32769' for constant `s3' out of range for type s
ConstDef.ice:120: initializer `32768' for constant `s4' out of range for type short
ConstDef.ice:124: initializer `-1' for constant `b3' out of range for type byte
ConstDef.ice:125: initializer `256' for constant `b4' out of range for type byte
+ConstDef.ice:127: illegal NUL character in string constant
+ConstDef.ice:128: illegal NUL character in string constant
diff --git a/cpp/test/Slice/errorDetection/ConstDef.ice b/cpp/test/Slice/errorDetection/ConstDef.ice
index af60a9e63c3..0c7796c6bc8 100644
--- a/cpp/test/Slice/errorDetection/ConstDef.ice
+++ b/cpp/test/Slice/errorDetection/ConstDef.ice
@@ -124,4 +124,7 @@ const byte b2 = 255; // OK
const byte b3 = -1; // underflow
const byte b4 = 256; // overflow
+const string nullstring1 = "a\000";
+const string nullstring2 = "a\x000";
+
};