[ https://issues.apache.org/jira/browse/THRIFT-4278?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jens Geyer updated THRIFT-4278: ------------------------------- Description: Create TBufferedTransport by using its receiver funciton. and using TCompactProtocol to communicate. But this object lack of `rstack` and `rpos`. It make app crash. details: {code title: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 } {code} generated code which crashes the app: {code} // input haven't property `rstack` and `rpos` if (input.rstack.length > input.rpos[input.rpos.length -1] + 1) { input.rstack.pop(); } {code} code about the crash {code} 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 resolve(entity) }) receiver(payload) }) {code} was: 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? details: 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) { input.rstack.pop(); } 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 resolve(entity) }) receiver(payload) }) > 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. > details: > {code title: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 > } > {code} > generated code which crashes the app: > {code} > // input haven't property `rstack` and `rpos` > if (input.rstack.length > input.rpos[input.rpos.length -1] + 1) { > input.rstack.pop(); > } > {code} > code about the crash > {code} > 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 > resolve(entity) > }) > receiver(payload) > }) > {code} -- This message was sent by Atlassian JIRA (v6.4.14#64029)