Opened 16 months ago

Closed 15 months ago

Last modified 13 months ago

#4813 closed defect (fixed)

UTFDataFormatException while serializing filter

Reported by: diegocarloslima Assignee: diegocarloslima
Priority: P2 Milestone: Adblock-Plus-for-Samsung-Browser-1.1.0
Module: Adblock-Plus-for-Samsung-Browser Keywords:
Cc: Blocked By:
Blocking: Platform: Samsung Browser
Ready: yes Confidential: no
Tester: Scheer Verified working: yes
Review URL(s):

https://codereview.adblockplus.org/29372653/

Description

Serializing/deserializing a filter might throw an UTFDataFormatException if the filter rule has more than 65535 bytes.

Environment

ABP for Samsung Internet 1.0.4
Samsung Galaxy S7 Edge
Android 6.0.1

How to reproduce

  1. Perform a fresh install of ABP for Samsung Internet
  2. Wait a while until the app downloads the latest exceptionrules.txt subscription

Observed behaviour

The following exception log is printed:

E/EventHandler: Event processing failed: String more than 65535 UTF bytes long java.io.UTFDataFormatException: String more than 65535 UTF bytes long
at java.nio.charset.ModifiedUtf8.countBytes(ModifiedUtf8.java:86)
at java.nio.charset.ModifiedUtf8.encode(ModifiedUtf8.java:119)
at java.io.DataOutputStream.writeUTF(DataOutputStream.java:197)
at org.adblockplus.sbrowser.contentblocker.engine.Subscription.serializeFilters(Subscription.java:439)
at org.adblockplus.sbrowser.contentblocker.engine.Subscription.updateSubscription(Subscription.java:633)
at org.adblockplus.sbrowser.contentblocker.engine.Subscriptions.updateSubscription(Subscriptions.java:271)
at org.adblockplus.sbrowser.contentblocker.engine.Engine$EventHandler.run(Engine.java:645)

Expected behaviour

The serialization/deserialization should complete without errors, even for filter rules that exceeds 65535 bytes.

Change History (4)

comment:1 Changed 16 months ago by diegocarloslima

  • Review URL(s) modified (diff)
  • Status changed from new to reviewing

comment:2 Changed 15 months ago by abpbot

A commit referencing this issue has landed:
Issue 4813 - UTFDataFormatException while serializing filter

comment:3 Changed 15 months ago by diegocarloslima

  • Resolution set to fixed
  • Status changed from reviewing to closed

comment:4 Changed 13 months ago by scheer

  • Tester changed from Unknown to Scheer
  • Verified working set
  • The following exception log is not printed when the steps above are followed:
E/EventHandler: Event processing failed: String more than 65535 UTF bytes long java.io.UTFDataFormatException: String more than 65535 UTF bytes long
at java.nio.charset.ModifiedUtf8.countBytes(ModifiedUtf8.java:86)
at java.nio.charset.ModifiedUtf8.encode(ModifiedUtf8.java:119)
at java.io.DataOutputStream.writeUTF(DataOutputStream.java:197)
at org.adblockplus.sbrowser.contentblocker.engine.Subscription.serializeFilters(Subscription.java:439)
at org.adblockplus.sbrowser.contentblocker.engine.Subscription.updateSubscription(Subscription.java:633)
at org.adblockplus.sbrowser.contentblocker.engine.Subscriptions.updateSubscription(Subscriptions.java:271)
at org.adblockplus.sbrowser.contentblocker.engine.Engine$EventHandler.run(Engine.java:645)

adblockplussbrowser-release-signed-1
Samsung Galaxy S7
Android 7.0

Note: See TracTickets for help on using tickets.