TianYI Wen created THRIFT-4278:

             Summary: Thrift Node.js library crashes app
                 Key: THRIFT-4278
                 URL: https://issues.apache.org/jira/browse/THRIFT-4278
             Project: Thrift
          Issue Type: Bug
          Components: Node.js - Library
    Affects Versions: 0.10.0
            Reporter: TianYI Wen

Create TBufferedTransport by using its receiver funciton. and using 
TCompactProtocol to communicate. But this object lack of `rstack` and `rpos`. 
It make app crash.

Is thrift library tested before release?


thrift file
struct CliRoomData
        10: i32 roomId
        20: string roomName
        30: i32 masterUserId
        40: map<i32, CliRoomUserData> mapUserData                       // key: 
user id         value: CliRoomUserData
        50: map<i32, CliRoomLevelData> mapLevelData                     // key: 
level id        value: CliRoomLevelData
        60: optional string groupId

generated code which crashes the app:

// input haven't property `rstack` and `rpos`
if (input.rstack.length > input.rpos[input.rpos.length -1] + 1) { 

code about the crash

  const entity = new Protocols[className]() // create the thrift object to read 
from protocol
    return new Promise((resolve, reject) => {
        const receiver = thrift.TBufferedTransport.receiver((reader) => { // 
create buffered using library
            const protocol = new thrift.TCompactProtocol(reader)
            entity.read(protocol) // crash the app

This message was sent by Atlassian JIRA

Reply via email to