rajrutu / jain-sip

Automatically exported from code.google.com/p/jain-sip
0 stars 0 forks source link

Large expire values cause IllegalArgumentException #136

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

1. Set Expires header to a large value, such as 3600000 

2. Expires.getExpires() returns an integer. This is itself a problem, as Java 
integer (max value 2**31 -1) can not cover the full RFC3261 Expire range (2**32 
- 1). Expires.getExpires() has also the same problem.

3. To schedule the timer, SIPClientTransactionImpl.sendRequest() converts the 
expiration value to milliseconds. For large values this causes overflow and a 
negative value is passed to sipStack.getTimer().schedule(), which triggers 
IllegalArgumentException.

An immediate fix for point 3 is change in SIPClientTransactionImpl.java, line 
1040

original:

        sipStack.getTimer().schedule(expiresTimerTask, expiresTime * 1000);

proposed fix 1:

        sipStack.getTimer().schedule(expiresTimerTask, expiresTime * 1000L);

proposed fix 2:

        sipStack.getTimer().schedule(expiresTimerTask, Long.valueOf(expiresTime) * 1000L);

Fixing point 2 can be more troublesome, left for further study.

Original issue reported on code.google.com by josemre...@gmail.com on 2 Jul 2014 at 9:04

GoogleCodeExporter commented 8 years ago
Attached patch for master branch

Original comment by josemre...@gmail.com on 7 Jul 2014 at 9:31

Attachments:

GoogleCodeExporter commented 8 years ago
This issue was updated by revision b801277ab3b4.

Committing Contribution and adding Non regression test

Original comment by jean.der...@telestax.com on 31 Jul 2014 at 4:42

GoogleCodeExporter commented 8 years ago
Corresponding JAIN-SIP Issue https://java.net/jira/browse/JSIP-467

Original comment by jean.der...@telestax.com on 31 Jul 2014 at 4:45