Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix index out of bounds crash in DropdownFieldController #8971

Merged
merged 2 commits into from
Jul 31, 2024

Conversation

amk-stripe
Copy link
Collaborator

@amk-stripe amk-stripe commented Jul 30, 2024

Summary

Fix index out of bounds crash in DropdownFieldController

Motivation

https://jira.corp.stripe.com/browse/RUN_MOBILESDK-3398

Testing

  • Added tests
  • Modified tests
  • Manually verified

Changelog

  • [FIXED]8971 Fixed a crash caused by an index out of bounds exception

@@ -27,7 +27,7 @@ class DropdownFieldController(
val selectedIndex: StateFlow<Int> = _selectedIndex
override val label: StateFlow<Int> = MutableStateFlow(config.label)
override val fieldValue = selectedIndex.mapAsStateFlow { displayItems[it] }
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

theoretically, this could still crash because of the displayItems[it] here. If it does, we would get notified via SDK console again

@amk-stripe amk-stripe marked this pull request as ready for review July 30, 2024 22:00
@amk-stripe amk-stripe requested review from a team as code owners July 30, 2024 22:00
Copy link
Contributor

github-actions bot commented Jul 30, 2024

Diffuse output:

OLD: identity-example-release-base.apk (signature: V1, V2)
NEW: identity-example-release-pr.apk (signature: V1, V2)

          │            compressed             │           uncompressed            
          ├─────────────┬─────────────┬───────┼─────────────┬─────────────┬───────
 APK      │ old         │ new         │ diff  │ old         │ new         │ diff  
──────────┼─────────────┼─────────────┼───────┼─────────────┼─────────────┼───────
      dex │       2 MiB │       2 MiB │ +94 B │     4.2 MiB │     4.2 MiB │ +80 B 
     arsc │ 1,023.9 KiB │ 1,023.9 KiB │   0 B │ 1,023.8 KiB │ 1,023.8 KiB │   0 B 
 manifest │     2.3 KiB │     2.3 KiB │   0 B │       8 KiB │       8 KiB │   0 B 
      res │   301.5 KiB │   301.5 KiB │   0 B │     455 KiB │     455 KiB │   0 B 
   native │     6.2 MiB │     6.2 MiB │   0 B │    15.8 MiB │    15.8 MiB │   0 B 
    asset │     6.7 KiB │     6.7 KiB │  +1 B │     6.5 KiB │     6.5 KiB │  +1 B 
    other │    85.5 KiB │    85.5 KiB │  -8 B │   158.7 KiB │   158.7 KiB │   0 B 
──────────┼─────────────┼─────────────┼───────┼─────────────┼─────────────┼───────
    total │     9.6 MiB │     9.6 MiB │ +87 B │    21.6 MiB │    21.6 MiB │ +81 B 

 DEX     │ old   │ new   │ diff      
─────────┼───────┼───────┼───────────
   files │     1 │     1 │ 0         
 strings │ 21305 │ 21305 │ 0 (+1 -1) 
   types │  6770 │  6770 │ 0 (+0 -0) 
 classes │  5559 │  5559 │ 0 (+0 -0) 
 methods │ 31123 │ 31123 │ 0 (+0 -0) 
  fields │ 18141 │ 18141 │ 0 (+0 -0) 

 ARSC    │ old  │ new  │ diff 
─────────┼──────┼──────┼──────
 configs │  164 │  164 │  0   
 entries │ 3392 │ 3392 │  0
APK
    compressed    │   uncompressed   │                               
──────────┬───────┼──────────┬───────┤                               
 size     │ diff  │ size     │ diff  │ path                          
──────────┼───────┼──────────┼───────┼───────────────────────────────
    2 MiB │ +94 B │  4.2 MiB │ +80 B │ ∆ classes.dex                 
 25.1 KiB │  -5 B │ 62.5 KiB │   0 B │ ∆ META-INF/MANIFEST.MF        
 28.3 KiB │  -4 B │ 62.6 KiB │   0 B │ ∆ META-INF/CERT.SF            
    6 KiB │  +1 B │  5.8 KiB │  +1 B │ ∆ assets/dexopt/baseline.prof 
  1.2 KiB │  +1 B │  1.2 KiB │   0 B │ ∆ META-INF/CERT.RSA           
──────────┼───────┼──────────┼───────┼───────────────────────────────
  2.1 MiB │ +87 B │  4.3 MiB │ +81 B │ (total)
DEX
STRINGS:

   old   │ new   │ diff      
  ───────┼───────┼───────────
   21305 │ 21305 │ 0 (+1 -1) 
  
  + ~~R8{backend:dex,compilation-mode:release,has-checksums:false,min-api:21,pg-map-id:e0b81fb,r8-mode:full,version:8.3.37}
  
  - ~~R8{backend:dex,compilation-mode:release,has-checksums:false,min-api:21,pg-map-id:48a6b21,r8-mode:full,version:8.3.37}

@amk-stripe amk-stripe enabled auto-merge (squash) July 30, 2024 23:34
@amk-stripe amk-stripe merged commit 72df0dc into master Jul 31, 2024
12 of 13 checks passed
@amk-stripe amk-stripe deleted the fix-crash-in-dropdown-controller branch July 31, 2024 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants