镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

How to handle callbacks #205

Description

@sabazahra

Hi,
I am trying pyt to work through callbacks. It taints the function arguments but not callbacks. If anyone has any idea about this , please let me know.

Activity

  1. bcaller commented on Sep 25, 2019

    @bcaller
    Collaborator

    Hello!
    Please can you give some example code to clarify what behaviour you're expecting as I'm not sure I fully understand the question.

  2. sabazahra commented on Sep 25, 2019

    @sabazahra
    Author

    class MyData:
    def init(self):
    self.a = None
    self.b = None
    self.x = None
    self.y = None
    def a_callback(self, msg):
    self.a = msg
    def b_callback(self, msg):
    self.b = msg
    def get_x(self):
    self.x = self.a +self.b
    def talker(self):
    pub = rospy.Publisher('C', Float64MultiArray, queue_size=10)
    rospy.init_node('talker', anonymous=True)
    rate = rospy.Rate(10) # 10hz
    while not rospy.is_shutdown():
    pub.publish(self.x)
    rate.sleep()
    if name == 'main':
    rospy.init_node('listener')
    mydata = MyData()
    rospy.Subscriber('a', Float64MultiArray , mydata.a_callback)
    mydata.get_x()
    mydata.talker()

    The above statement that is bold uses callback (a_callback) but the 'msg' in callback does not gets tainted at all giving us no vulnerability as a result but it give vulnerability. My source is supposed to be rospy.Subscriber and sink is rospy.Publisher . I hope I made it a little clear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions