Bug #2956

potential data races in NewChatActivity.java

Added by Anonymous almost 4 years ago. Updated over 2 years ago.

Status:NewStart date:02/13/2014
Priority:NormalDue date:
Assignee:n8fr8% Done:


Target version:v15 - AWESOME APP


Dear developers of ChatSecureAndroid,

I'm a Ph.D. student and I'm doing research on checking data race for Android apps. I found there are data races that may lead to potential bugs in src/info/guardianproject/otr/app/im/app/NewChatActivity.java:

The AsyncTask in "startGroupChat" method writes to field "mRequestedChatId" at line 2173. This task is eventually be called by "onLoadFinished" method at line 300 through method "resolveIntent". However, "onLoadFinished" also uses "mRequestedChatId" at lines 301-303. This lead to data race on "mRequestedChatId". Do you think this race may lead to potential bugs? Do you need synchronization on "mRequestedChatId"?

"mRequestedChatId" is also written by "startChat" method at line 1944 and 1950, this can also be a race with the written at line 2173.

Also, the AsyncTask invokes "showChat" method and "showChat" access the GUI elements "mChatPagerAdapter" and "mChatPager" at line 690 and 700. Android documents say we shouldn't access GUI outside main thread. So this should be a problem. It also leads to a race on these GUI widgets, and the Cursor at line 690, since "mChatPagerAdapter", "mChatPager" and the Cursor is also read/written by main thread.
A fix could be put the statements at 690 and 700 into a Handler or runOnUiThread method.


p.s., I also post this issue in your github issue tracking system, before I notice you probably use this issue tracker.


#1 Updated by jacklondongood almost 4 years ago

Dear developers of ChatSecureAndroid,

I reported this issue two weeks ago. Do you have any comments on these races? Will they lead to concurrency bugs? It'd be better if we can eliminate these races.


#2 Updated by abeluck almost 4 years ago

Hi Yu,

Thanks for reporting this bug, don't worry we haven't forgotten about it. We've been quite busy with other projects and we'll get to this task as soon as we can!

Again, many thanks for this report!

Cheers ~abel

#3 Updated by n8fr8 almost 4 years ago

  • Target version changed from v13 - October Oooya to v14 - Armadillo's Agram

#4 Updated by n8fr8 over 2 years ago

  • Target version changed from v14 - Armadillo's Agram to v14.2 bug fix update!

#5 Updated by n8fr8 over 2 years ago

  • Target version changed from v14.2 bug fix update! to v15 - AWESOME APP

Also available in: Atom PDF