You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
/// The `resize` method takes as its argument a list with two values, first
419
-
/// the channel name (a UTF-8 string less than 254 bytes long), and second the
420
-
/// allowed size of the channel buffer (an integer between 0 and 2147483647).
432
+
/// the channel name (a UTF-8 string less than 254 bytes long and not
433
+
/// containing any null bytes), and second the allowed size of the channel
434
+
/// buffer (an integer between 0 and 2147483647).
421
435
///
422
436
/// Upon receiving the message, the channel's buffer is resized. If necessary,
423
437
/// messages are silently discarded to ensure the buffer is no bigger than
@@ -433,8 +447,9 @@ class ChannelBuffers {
433
447
/// ## `overflow`
434
448
///
435
449
/// The `overflow` method takes as its argument a list with two values, first
436
-
/// the channel name (a UTF-8 string less than 254 bytes long), and second a
437
-
/// boolean which is true if overflow is expected and false if it is not.
450
+
/// the channel name (a UTF-8 string less than 254 bytes long and not
451
+
/// containing any null bytes), and second a boolean which is true if overflow
452
+
/// is expected and false if it is not.
438
453
///
439
454
/// This sets a flag on the channel in debug mode. In release mode the message
440
455
/// is silently ignored. The flag indicates whether overflow is expected on this
@@ -473,6 +488,9 @@ class ChannelBuffers {
473
488
}
474
489
index +=1;
475
490
finalString channelName = utf8.decode(bytes.sublist(index, index + channelNameLength));
491
+
if (channelName.contains('\u0000')) {
492
+
throwException("Invalid arguments for 'resize' method sent to $kControlChannelName (channel name must not contain any null bytes)");
493
+
}
476
494
index += channelNameLength;
477
495
if (bytes[index] !=0x03) { // 3 = value code for uint32
478
496
throwException("Invalid arguments for 'resize' method sent to $kControlChannelName (second argument must be an integer in the range 0 to 2147483647)");
@@ -533,6 +551,7 @@ class ChannelBuffers {
533
551
voidresize(String name, int newSize) {
534
552
_Channel? channel = _channels[name];
535
553
if (channel ==null) {
554
+
assert(!name.contains('\u0000'), 'Channel names must not contain U+0000 NULL characters.');
536
555
channel =_Channel(newSize);
537
556
_channels[name] = channel;
538
557
} else {
@@ -556,6 +575,7 @@ class ChannelBuffers {
556
575
assert(() {
557
576
_Channel? channel = _channels[name];
558
577
if (channel ==null&& allowed) {
578
+
assert(!name.contains('\u0000'), 'Channel names must not contain U+0000 NULL characters.');
0 commit comments