about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--users/tazjin/german-string/src/lib.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/users/tazjin/german-string/src/lib.rs b/users/tazjin/german-string/src/lib.rs
index 9aca9c72b8e9..eb6d02f29131 100644
--- a/users/tazjin/german-string/src/lib.rs
+++ b/users/tazjin/german-string/src/lib.rs
@@ -38,6 +38,10 @@ impl GermanString {
     // strings are destroyed when the object is destroyed. Persistent strings
     // are not supported yet.
     pub fn new_transient(bytes: &[u8]) -> GermanString {
+        if bytes.len() > u32::MAX as usize {
+            panic!("GermanString maximum length is {} bytes", u32::MAX);
+        }
+
         if bytes.len() <= 12 {
             let mut s = GSSmall {
                 len: bytes.len() as u32,