mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
remove obsolete size restriction on port messages
This commit is contained in:
parent
05c1ba2e6e
commit
aec85c5a4f
3 changed files with 33 additions and 56 deletions
|
@ -1,3 +1,11 @@
|
|||
2023-12-05 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSMessagePort.m:
|
||||
* Source/NSSocketPort.m:
|
||||
Remove obsolete restriction on DO message length. Add exception handler
|
||||
to invalidate port if we are unable to allocate more memory for a very
|
||||
large port message.
|
||||
|
||||
2023-11-23 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSBundle.m:
|
||||
|
|
|
@ -103,11 +103,6 @@
|
|||
+ (BOOL) _exists: (int)pid;
|
||||
@end
|
||||
|
||||
/*
|
||||
* Largest chunk of data possible in DO
|
||||
*/
|
||||
static uint32_t maxDataLength = 32 * 1024 * 1024;
|
||||
|
||||
#if 0
|
||||
#define M_LOCK(X) {NSDebugMLLog(@"NSMessagePort",@"lock %@",X); [X lock];}
|
||||
#define M_UNLOCK(X) {NSDebugMLLog(@"NSMessagePort",@"unlock %@",X); [X unlock];}
|
||||
|
@ -580,15 +575,20 @@ static Class runLoopClass;
|
|||
else
|
||||
{
|
||||
want = [rData length];
|
||||
if (want < rWant)
|
||||
if (want < MAX(rWant, NETBLOCK))
|
||||
{
|
||||
want = rWant;
|
||||
[rData setLength: want];
|
||||
}
|
||||
if (want < NETBLOCK)
|
||||
{
|
||||
want = NETBLOCK;
|
||||
[rData setLength: want];
|
||||
want = MAX(rWant, NETBLOCK);
|
||||
NS_DURING
|
||||
{
|
||||
[rData setLength: want];
|
||||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
M_UNLOCK(myLock);
|
||||
[self invalidate];
|
||||
[localException raise];
|
||||
}
|
||||
NS_ENDHANDLER
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -682,14 +682,6 @@ static Class runLoopClass;
|
|||
}
|
||||
else
|
||||
{
|
||||
if (l > maxDataLength)
|
||||
{
|
||||
NSLog(@"%@ - unreasonable length (%u) for data",
|
||||
self, l);
|
||||
M_UNLOCK(myLock);
|
||||
[self invalidate];
|
||||
return;
|
||||
}
|
||||
/*
|
||||
* If not a port or zero length data,
|
||||
* we discard the data read so far and fill the
|
||||
|
@ -705,14 +697,6 @@ static Class runLoopClass;
|
|||
}
|
||||
else if (rType == GSP_HEAD)
|
||||
{
|
||||
if (l > maxDataLength)
|
||||
{
|
||||
NSLog(@"%@ - unreasonable length (%u) for data",
|
||||
self, l);
|
||||
M_UNLOCK(myLock);
|
||||
[self invalidate];
|
||||
return;
|
||||
}
|
||||
/*
|
||||
* If not a port or zero length data,
|
||||
* we discard the data read so far and fill the
|
||||
|
|
|
@ -139,11 +139,6 @@ static int socketError()
|
|||
}
|
||||
#endif /* !_WIN32 */
|
||||
|
||||
/*
|
||||
* Largest chunk of data possible in DO
|
||||
*/
|
||||
static uint32_t maxDataLength = 32 * 1024 * 1024;
|
||||
|
||||
/* Options for TLS encryption of connections
|
||||
*/
|
||||
static NSDictionary *tlsClientOptions;
|
||||
|
@ -883,15 +878,19 @@ static Class runLoopClass;
|
|||
else
|
||||
{
|
||||
want = [rData length];
|
||||
if (want < rWant)
|
||||
if (want < MAX(rWant, NETBLOCK))
|
||||
{
|
||||
want = rWant;
|
||||
[rData setLength: want];
|
||||
}
|
||||
if (want < NETBLOCK)
|
||||
{
|
||||
want = NETBLOCK;
|
||||
[rData setLength: want];
|
||||
want = MAX(rWant, NETBLOCK);
|
||||
NS_DURING
|
||||
{
|
||||
[rData setLength: want];
|
||||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
[self invalidate];
|
||||
[localException raise];
|
||||
}
|
||||
NS_ENDHANDLER
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1013,13 +1012,6 @@ static Class runLoopClass;
|
|||
}
|
||||
else
|
||||
{
|
||||
if (l > maxDataLength)
|
||||
{
|
||||
NSLog(@"%@ - unreasonable length (%u) for data",
|
||||
self, l);
|
||||
[self invalidate];
|
||||
return;
|
||||
}
|
||||
/*
|
||||
* If not a port or zero length data,
|
||||
* we discard the data read so far and fill the
|
||||
|
@ -1035,13 +1027,6 @@ static Class runLoopClass;
|
|||
}
|
||||
else if (rType == GSP_HEAD)
|
||||
{
|
||||
if (l > maxDataLength)
|
||||
{
|
||||
NSLog(@"%@ - unreasonable length (%u) for data",
|
||||
self, l);
|
||||
[self invalidate];
|
||||
return;
|
||||
}
|
||||
/*
|
||||
* If not a port or zero length data,
|
||||
* we discard the data read so far and fill the
|
||||
|
|
Loading…
Reference in a new issue