You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Alexey (JIRA)" <ji...@apache.org> on 2012/09/21 15:15:08 UTC
[jira] [Created] (THRIFT-1700) Number overflow in ReadFrame.
Alexey created THRIFT-1700:
------------------------------
Summary: Number overflow in ReadFrame.
Key: THRIFT-1700
URL: https://issues.apache.org/jira/browse/THRIFT-1700
Project: Thrift
Issue Type: Bug
Components: C# - Library
Affects Versions: 0.8
Reporter: Alexey
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (THRIFT-1700) Number overflow in ReadFrame.
Posted by "Jens Geyer (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-1700?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13469610#comment-13469610 ]
Jens Geyer commented on THRIFT-1700:
------------------------------------
{We use C# for client. Seems like thrift don't generates async wrappers for sync methods when using C#. So we made our hand-made task-based wrappers. }
Have you checked the switches for C#? Thrift indeed supports async/await and Task<>.
> Number overflow in ReadFrame.
> -----------------------------
>
> Key: THRIFT-1700
> URL: https://issues.apache.org/jira/browse/THRIFT-1700
> Project: Thrift
> Issue Type: Bug
> Components: C# - Library
> Affects Versions: 0.8
> Reporter: Alexey
>
> private void ReadFrame()
> {
> byte[] i32rd = new byte[header_size];
> transport.ReadAll(i32rd, 0, header_size);
> int size =
> ((i32rd[0] & 0xff) << 24) |
> ((i32rd[1] & 0xff) << 16) |
> ((i32rd[2] & 0xff) << 8) |
> ((i32rd[3] & 0xff));
> byte[] buff = new byte[size];
> transport.ReadAll(buff, 0, size);
> readBuffer = new MemoryStream(buff);
> }
> Here, when calculating size, number overflow throws sometimes.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (THRIFT-1700) Number overflow in ReadFrame.
Posted by "Alexey (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-1700?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Alexey updated THRIFT-1700:
---------------------------
Description:
rivate void ReadFrame()
{
byte[] i32rd = new byte[header_size];
transport.ReadAll(i32rd, 0, header_size);
int size =
((i32rd[0] & 0xff) << 24) |
((i32rd[1] & 0xff) << 16) |
((i32rd[2] & 0xff) << 8) |
((i32rd[3] & 0xff));
byte[] buff = new byte[size];
transport.ReadAll(buff, 0, size);
readBuffer = new MemoryStream(buff);
}
Here, when calculating size, number overflow throws sometimes.
> Number overflow in ReadFrame.
> -----------------------------
>
> Key: THRIFT-1700
> URL: https://issues.apache.org/jira/browse/THRIFT-1700
> Project: Thrift
> Issue Type: Bug
> Components: C# - Library
> Affects Versions: 0.8
> Reporter: Alexey
>
> rivate void ReadFrame()
> {
> byte[] i32rd = new byte[header_size];
> transport.ReadAll(i32rd, 0, header_size);
> int size =
> ((i32rd[0] & 0xff) << 24) |
> ((i32rd[1] & 0xff) << 16) |
> ((i32rd[2] & 0xff) << 8) |
> ((i32rd[3] & 0xff));
> byte[] buff = new byte[size];
> transport.ReadAll(buff, 0, size);
> readBuffer = new MemoryStream(buff);
> }
> Here, when calculating size, number overflow throws sometimes.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (THRIFT-1700) Number overflow in ReadFrame.
Posted by "Maxim Korobov (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-1700?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13470071#comment-13470071 ]
Maxim Korobov commented on THRIFT-1700:
---------------------------------------
Oh, yes. One more thing... We are using MonoTouch framework, which is currently [doesn't support|http://stackoverflow.com/questions/10661137/aync-and-await-in-monotouch] C# 5.0 features.
> Number overflow in ReadFrame.
> -----------------------------
>
> Key: THRIFT-1700
> URL: https://issues.apache.org/jira/browse/THRIFT-1700
> Project: Thrift
> Issue Type: Bug
> Components: C# - Library
> Affects Versions: 0.8
> Reporter: Alexey
>
> private void ReadFrame()
> {
> byte[] i32rd = new byte[header_size];
> transport.ReadAll(i32rd, 0, header_size);
> int size =
> ((i32rd[0] & 0xff) << 24) |
> ((i32rd[1] & 0xff) << 16) |
> ((i32rd[2] & 0xff) << 8) |
> ((i32rd[3] & 0xff));
> byte[] buff = new byte[size];
> transport.ReadAll(buff, 0, size);
> readBuffer = new MemoryStream(buff);
> }
> Here, when calculating size, number overflow throws sometimes.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (THRIFT-1700) Number overflow in ReadFrame.
Posted by "Alexey (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-1700?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13461042#comment-13461042 ]
Alexey commented on THRIFT-1700:
--------------------------------
Execuse me for such small amount of information.
I can't reproduce it every time, it just throws sometimes and sometimes not.
Yes, this happens in TBinaryProtocol.
Here is the exception with call stack:
http://pastie.org/4778845
i32rd is the array of 4 bytes:
[0] = 129
[1] = 208
[2] = 181
[3] = 208
It also crashes with different i32rd values (e.g. 128, 1, 0, 2);
I could also give you all values in current TFramedTransport object.
About changing to uint: can you give me a hint what (and where) I need to change in thrift in order to change size to uint?
> Number overflow in ReadFrame.
> -----------------------------
>
> Key: THRIFT-1700
> URL: https://issues.apache.org/jira/browse/THRIFT-1700
> Project: Thrift
> Issue Type: Bug
> Components: C# - Library
> Affects Versions: 0.8
> Reporter: Alexey
>
> private void ReadFrame()
> {
> byte[] i32rd = new byte[header_size];
> transport.ReadAll(i32rd, 0, header_size);
> int size =
> ((i32rd[0] & 0xff) << 24) |
> ((i32rd[1] & 0xff) << 16) |
> ((i32rd[2] & 0xff) << 8) |
> ((i32rd[3] & 0xff));
> byte[] buff = new byte[size];
> transport.ReadAll(buff, 0, size);
> readBuffer = new MemoryStream(buff);
> }
> Here, when calculating size, number overflow throws sometimes.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Comment Edited] (THRIFT-1700) Number overflow in ReadFrame.
Posted by "Maxim Korobov (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-1700?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13469320#comment-13469320 ]
Maxim Korobov edited comment on THRIFT-1700 at 10/4/12 11:23 PM:
-----------------------------------------------------------------
??I finally got to see your code...??
We use C# for client. Seems like thrift don't generates async wrappers for sync methods when using C#. So we made our hand-made task-based wrappers. Here they are:
{code:title=C#}
public void GetStream (GetStreamAction action, Action <StreamContent> onSuccess = null,
Action <Exception> onError = null)
{
factory.StartNew<StreamContent> (() => {
try {
ConnectIfNeed ();
var result = Client.getStream (action);
if (onSuccess != null)
onSuccess (result);
return result;
} catch (Exception e) {
if (onError != null)
onError (e);
return null;
}
}
);
}
{code}
{code:title=thrift}
struct GetStreamAction {
1: string authKey
2: commons.StreamId streamId
3: optional commons.Cursor cursor
}
commons.StreamContent getStream( 1 : GetStreamAction action ) throws (1: BackendException ex)
{code}
??It seems like your frame is just too big :)??
??You'd have to change ReadAll as well in order to be able to read a uint or you will get a negative value when casing it back to int.??
I will try it out.
??Anyway, it would "only" allow you to read another 2 million bytes, is it enough for you???
2 billions, maybe?
??did you try with the buffered transport? and what is the other target language? actually it should NOT send a size bigger than int.Max!??
I will try it out. Our colleagues at server-side uses Java+Scala.
was (Author: maximkorobov):
??I finally got to see your code...??
We use C# for client. Seems like thrift don't generates async wrappers for sync methods when using C#. So we made our hand-made task-based wrappers. Here it is:
{code:title=C#}
public void GetStream (GetStreamAction action, Action <StreamContent> onSuccess = null,
Action <Exception> onError = null)
{
factory.StartNew<StreamContent> (() => {
try {
ConnectIfNeed ();
var result = Client.getStream (action);
if (onSuccess != null)
onSuccess (result);
return result;
} catch (Exception e) {
if (onError != null)
onError (e);
return null;
}
}
);
}
{code}
{code:title=thrift}
struct GetStreamAction {
1: string authKey
2: commons.StreamId streamId
3: optional commons.Cursor cursor
}
commons.StreamContent getStream( 1 : GetStreamAction action ) throws (1: BackendException ex)
{code}
??It seems like your frame is just too big :)??
??You'd have to change ReadAll as well in order to be able to read a uint or you will get a negative value when casing it back to int.??
I will try it out.
??Anyway, it would "only" allow you to read another 2 million bytes, is it enough for you???
2 billions, maybe?
??did you try with the buffered transport? and what is the other target language? actually it should NOT send a size bigger than int.Max!??
I will try it out. Our colleagues at server-side uses Java+Scala.
> Number overflow in ReadFrame.
> -----------------------------
>
> Key: THRIFT-1700
> URL: https://issues.apache.org/jira/browse/THRIFT-1700
> Project: Thrift
> Issue Type: Bug
> Components: C# - Library
> Affects Versions: 0.8
> Reporter: Alexey
>
> private void ReadFrame()
> {
> byte[] i32rd = new byte[header_size];
> transport.ReadAll(i32rd, 0, header_size);
> int size =
> ((i32rd[0] & 0xff) << 24) |
> ((i32rd[1] & 0xff) << 16) |
> ((i32rd[2] & 0xff) << 8) |
> ((i32rd[3] & 0xff));
> byte[] buff = new byte[size];
> transport.ReadAll(buff, 0, size);
> readBuffer = new MemoryStream(buff);
> }
> Here, when calculating size, number overflow throws sometimes.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Comment Edited] (THRIFT-1700) Number overflow in ReadFrame.
Posted by "Jens Geyer (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-1700?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13469610#comment-13469610 ]
Jens Geyer edited comment on THRIFT-1700 at 10/5/12 6:12 AM:
-------------------------------------------------------------
{quote}
We use C# for client. Seems like thrift don't generates async wrappers for sync methods when using C#. So we made our hand-made task-based wrappers.
{quote}
Have you checked the switches for C#? Thrift indeed supports async/await and Task<>.
was (Author: jensg):
{We use C# for client. Seems like thrift don't generates async wrappers for sync methods when using C#. So we made our hand-made task-based wrappers. }
Have you checked the switches for C#? Thrift indeed supports async/await and Task<>.
> Number overflow in ReadFrame.
> -----------------------------
>
> Key: THRIFT-1700
> URL: https://issues.apache.org/jira/browse/THRIFT-1700
> Project: Thrift
> Issue Type: Bug
> Components: C# - Library
> Affects Versions: 0.8
> Reporter: Alexey
>
> private void ReadFrame()
> {
> byte[] i32rd = new byte[header_size];
> transport.ReadAll(i32rd, 0, header_size);
> int size =
> ((i32rd[0] & 0xff) << 24) |
> ((i32rd[1] & 0xff) << 16) |
> ((i32rd[2] & 0xff) << 8) |
> ((i32rd[3] & 0xff));
> byte[] buff = new byte[size];
> transport.ReadAll(buff, 0, size);
> readBuffer = new MemoryStream(buff);
> }
> Here, when calculating size, number overflow throws sometimes.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (THRIFT-1700) Number overflow in ReadFrame.
Posted by "Henrique Mendonca (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-1700?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13460614#comment-13460614 ]
Henrique Mendonca commented on THRIFT-1700:
-------------------------------------------
Sometimes? where? it would be nice if we could reproduce it, e.g. unit-tests
then please read http://thrift.apache.org/docs/HowToContribute/
is this the TBinaryProtocol?
does it get resolved if you change it to *uint size = ...* ?
> Number overflow in ReadFrame.
> -----------------------------
>
> Key: THRIFT-1700
> URL: https://issues.apache.org/jira/browse/THRIFT-1700
> Project: Thrift
> Issue Type: Bug
> Components: C# - Library
> Affects Versions: 0.8
> Reporter: Alexey
>
> private void ReadFrame()
> {
> byte[] i32rd = new byte[header_size];
> transport.ReadAll(i32rd, 0, header_size);
> int size =
> ((i32rd[0] & 0xff) << 24) |
> ((i32rd[1] & 0xff) << 16) |
> ((i32rd[2] & 0xff) << 8) |
> ((i32rd[3] & 0xff));
> byte[] buff = new byte[size];
> transport.ReadAll(buff, 0, size);
> readBuffer = new MemoryStream(buff);
> }
> Here, when calculating size, number overflow throws sometimes.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (THRIFT-1700) Number overflow in ReadFrame.
Posted by "Maxim Korobov (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-1700?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13469320#comment-13469320 ]
Maxim Korobov commented on THRIFT-1700:
---------------------------------------
??I finally got to see your code...??
We use C# for client. Seems like thrift don't generates async wrappers for sync methods when using C#. So we made our hand-made task-based wrappers. Here it is:
{code:title=C#}
public void GetStream (GetStreamAction action, Action <StreamContent> onSuccess = null,
Action <Exception> onError = null)
{
factory.StartNew<StreamContent> (() => {
try {
ConnectIfNeed ();
var result = Client.getStream (action);
if (onSuccess != null)
onSuccess (result);
return result;
} catch (Exception e) {
if (onError != null)
onError (e);
return null;
}
}
);
}
{code}
{code:title=thrift}
struct GetStreamAction {
1: string authKey
2: commons.StreamId streamId
3: optional commons.Cursor cursor
}
commons.StreamContent getStream( 1 : GetStreamAction action ) throws (1: BackendException ex)
{code}
??It seems like your frame is just too big :)??
??You'd have to change ReadAll as well in order to be able to read a uint or you will get a negative value when casing it back to int.??
I will try it out.
??Anyway, it would "only" allow you to read another 2 million bytes, is it enough for you???
2 billions, maybe?
??did you try with the buffered transport? and what is the other target language? actually it should NOT send a size bigger than int.Max!??
I will try it out. Our colleagues at server-side uses Java+Scala.
> Number overflow in ReadFrame.
> -----------------------------
>
> Key: THRIFT-1700
> URL: https://issues.apache.org/jira/browse/THRIFT-1700
> Project: Thrift
> Issue Type: Bug
> Components: C# - Library
> Affects Versions: 0.8
> Reporter: Alexey
>
> private void ReadFrame()
> {
> byte[] i32rd = new byte[header_size];
> transport.ReadAll(i32rd, 0, header_size);
> int size =
> ((i32rd[0] & 0xff) << 24) |
> ((i32rd[1] & 0xff) << 16) |
> ((i32rd[2] & 0xff) << 8) |
> ((i32rd[3] & 0xff));
> byte[] buff = new byte[size];
> transport.ReadAll(buff, 0, size);
> readBuffer = new MemoryStream(buff);
> }
> Here, when calculating size, number overflow throws sometimes.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Comment Edited] (THRIFT-1700) Number overflow in ReadFrame.
Posted by "Maxim Korobov (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-1700?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13469321#comment-13469321 ]
Maxim Korobov edited comment on THRIFT-1700 at 10/4/12 11:33 PM:
-----------------------------------------------------------------
BTW, does thrift generator knows that byte in C# is [Unsigned 8-bit integer|http://msdn.microsoft.com/en-us/library/5bdb6693%28v=vs.71%29.aspx], not [8-bit signed two's complement integer|http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html] like in Java.
was (Author: maximkorobov):
BTW, did thrift generator knows that byte in C# is [Unsigned 8-bit integer|http://msdn.microsoft.com/en-us/library/5bdb6693%28v=vs.71%29.aspx], not [8-bit signed two's complement integer|http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html] like in Java.
> Number overflow in ReadFrame.
> -----------------------------
>
> Key: THRIFT-1700
> URL: https://issues.apache.org/jira/browse/THRIFT-1700
> Project: Thrift
> Issue Type: Bug
> Components: C# - Library
> Affects Versions: 0.8
> Reporter: Alexey
>
> private void ReadFrame()
> {
> byte[] i32rd = new byte[header_size];
> transport.ReadAll(i32rd, 0, header_size);
> int size =
> ((i32rd[0] & 0xff) << 24) |
> ((i32rd[1] & 0xff) << 16) |
> ((i32rd[2] & 0xff) << 8) |
> ((i32rd[3] & 0xff));
> byte[] buff = new byte[size];
> transport.ReadAll(buff, 0, size);
> readBuffer = new MemoryStream(buff);
> }
> Here, when calculating size, number overflow throws sometimes.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (THRIFT-1700) Number overflow in ReadFrame.
Posted by "Maxim Korobov (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-1700?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13469321#comment-13469321 ]
Maxim Korobov commented on THRIFT-1700:
---------------------------------------
BTW, did thrift generator knows that byte in C# is [Unsigned 8-bit integer|http://msdn.microsoft.com/en-us/library/5bdb6693%28v=vs.71%29.aspx], not [8-bit signed two's complement integer|http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html] like in Java.
> Number overflow in ReadFrame.
> -----------------------------
>
> Key: THRIFT-1700
> URL: https://issues.apache.org/jira/browse/THRIFT-1700
> Project: Thrift
> Issue Type: Bug
> Components: C# - Library
> Affects Versions: 0.8
> Reporter: Alexey
>
> private void ReadFrame()
> {
> byte[] i32rd = new byte[header_size];
> transport.ReadAll(i32rd, 0, header_size);
> int size =
> ((i32rd[0] & 0xff) << 24) |
> ((i32rd[1] & 0xff) << 16) |
> ((i32rd[2] & 0xff) << 8) |
> ((i32rd[3] & 0xff));
> byte[] buff = new byte[size];
> transport.ReadAll(buff, 0, size);
> readBuffer = new MemoryStream(buff);
> }
> Here, when calculating size, number overflow throws sometimes.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (THRIFT-1700) Number overflow in ReadFrame.
Posted by "Alexey (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-1700?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13461050#comment-13461050 ]
Alexey commented on THRIFT-1700:
--------------------------------
Well, I've changed int to uint in only 2 places:
http://pastie.org/4778992
But since size used in creating byte array, it still throws number overflow.
> Number overflow in ReadFrame.
> -----------------------------
>
> Key: THRIFT-1700
> URL: https://issues.apache.org/jira/browse/THRIFT-1700
> Project: Thrift
> Issue Type: Bug
> Components: C# - Library
> Affects Versions: 0.8
> Reporter: Alexey
>
> private void ReadFrame()
> {
> byte[] i32rd = new byte[header_size];
> transport.ReadAll(i32rd, 0, header_size);
> int size =
> ((i32rd[0] & 0xff) << 24) |
> ((i32rd[1] & 0xff) << 16) |
> ((i32rd[2] & 0xff) << 8) |
> ((i32rd[3] & 0xff));
> byte[] buff = new byte[size];
> transport.ReadAll(buff, 0, size);
> readBuffer = new MemoryStream(buff);
> }
> Here, when calculating size, number overflow throws sometimes.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Comment Edited] (THRIFT-1700) Number overflow in ReadFrame.
Posted by "Alexey (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-1700?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13461050#comment-13461050 ]
Alexey edited comment on THRIFT-1700 at 9/22/12 6:39 PM:
---------------------------------------------------------
Well, I've changed int to uint in only 2 places:
http://pastie.org/4778992
But since size used in creating byte array, it still throws number overflow.
P.S. It will be great if you'll explain me the meaning of the code that calculates size.
"number & 0xff" stands for reducing from 64 to 32 bit? Or what?
And why there is bitwise or? And why shifting?
was (Author: folex):
Well, I've changed int to uint in only 2 places:
http://pastie.org/4778992
But since size used in creating byte array, it still throws number overflow.
> Number overflow in ReadFrame.
> -----------------------------
>
> Key: THRIFT-1700
> URL: https://issues.apache.org/jira/browse/THRIFT-1700
> Project: Thrift
> Issue Type: Bug
> Components: C# - Library
> Affects Versions: 0.8
> Reporter: Alexey
>
> private void ReadFrame()
> {
> byte[] i32rd = new byte[header_size];
> transport.ReadAll(i32rd, 0, header_size);
> int size =
> ((i32rd[0] & 0xff) << 24) |
> ((i32rd[1] & 0xff) << 16) |
> ((i32rd[2] & 0xff) << 8) |
> ((i32rd[3] & 0xff));
> byte[] buff = new byte[size];
> transport.ReadAll(buff, 0, size);
> readBuffer = new MemoryStream(buff);
> }
> Here, when calculating size, number overflow throws sometimes.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (THRIFT-1700) Number overflow in ReadFrame.
Posted by "Alexey (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-1700?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Alexey updated THRIFT-1700:
---------------------------
Description:
private void ReadFrame()
{
byte[] i32rd = new byte[header_size];
transport.ReadAll(i32rd, 0, header_size);
int size =
((i32rd[0] & 0xff) << 24) |
((i32rd[1] & 0xff) << 16) |
((i32rd[2] & 0xff) << 8) |
((i32rd[3] & 0xff));
byte[] buff = new byte[size];
transport.ReadAll(buff, 0, size);
readBuffer = new MemoryStream(buff);
}
Here, when calculating size, number overflow throws sometimes.
was:
rivate void ReadFrame()
{
byte[] i32rd = new byte[header_size];
transport.ReadAll(i32rd, 0, header_size);
int size =
((i32rd[0] & 0xff) << 24) |
((i32rd[1] & 0xff) << 16) |
((i32rd[2] & 0xff) << 8) |
((i32rd[3] & 0xff));
byte[] buff = new byte[size];
transport.ReadAll(buff, 0, size);
readBuffer = new MemoryStream(buff);
}
Here, when calculating size, number overflow throws sometimes.
> Number overflow in ReadFrame.
> -----------------------------
>
> Key: THRIFT-1700
> URL: https://issues.apache.org/jira/browse/THRIFT-1700
> Project: Thrift
> Issue Type: Bug
> Components: C# - Library
> Affects Versions: 0.8
> Reporter: Alexey
>
> private void ReadFrame()
> {
> byte[] i32rd = new byte[header_size];
> transport.ReadAll(i32rd, 0, header_size);
> int size =
> ((i32rd[0] & 0xff) << 24) |
> ((i32rd[1] & 0xff) << 16) |
> ((i32rd[2] & 0xff) << 8) |
> ((i32rd[3] & 0xff));
> byte[] buff = new byte[size];
> transport.ReadAll(buff, 0, size);
> readBuffer = new MemoryStream(buff);
> }
> Here, when calculating size, number overflow throws sometimes.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira