Skip to content

Commit

Permalink
Merge branch 'release/0.084'
Browse files Browse the repository at this point in the history
  • Loading branch information
peczenyj committed Dec 14, 2023
2 parents 99d84ce + 208cb2c commit 4847709
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 5 deletions.
3 changes: 3 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
0.084
- fix a bug while parsing valid consent strings range-based, see https://github.com/peczenyj/GDPR-IAB-TCFv2/issues/20

0.083
- refactor on Publisher Restriction parsing.
- small fixes about data and offset.
Expand Down
1 change: 1 addition & 0 deletions MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ README.pod
t/00-load.t
t/01-parse.t
t/02-json.t
t/03-bugs.t
t/99-pod.t
2 changes: 1 addition & 1 deletion README.pod
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ GDPR::IAB::TCFv2 - Transparency & Consent String version 2 parser

=head1 VERSION

Version 0.083
Version 0.084

=head1 SYNOPSIS

Expand Down
6 changes: 3 additions & 3 deletions lib/GDPR/IAB/TCFv2.pm
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use GDPR::IAB::TCFv2::BitUtils qw<is_set
use GDPR::IAB::TCFv2::PublisherRestrictions;
use GDPR::IAB::TCFv2::RangeSection;

our $VERSION = "0.083";
our $VERSION = "0.084";

use constant {
CONSENT_STRING_TCF2_SEPARATOR => '.',
Expand Down Expand Up @@ -547,7 +547,7 @@ sub _is_vendor_consent_range_encoding {
sub _parse_range_section {
my ( $self, $max_id, $range_section_start_offset ) = @_;

my $data = substr( $self->{data}, $range_section_start_offset, $max_id );
my $data = substr( $self->{data}, $range_section_start_offset );

my ( $range_section, $next_offset ) =
GDPR::IAB::TCFv2::RangeSection->Parse(
Expand Down Expand Up @@ -620,7 +620,7 @@ GDPR::IAB::TCFv2 - Transparency & Consent String version 2 parser
=head1 VERSION
Version 0.083
Version 0.084
=head1 SYNOPSIS
Expand Down
2 changes: 1 addition & 1 deletion t/01-parse.t
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ subtest "invalid tcf consent string candidates" => sub {
GDPR::IAB::TCFv2->Parse(
'COvcSpYOvcSpYC9AAAENAPCAAAAAAAAAAAAAAFQBgAAgABAACAAEAAQAAgAA')
}
qr/index out of bounds on offset 0: can't read 12, only has: 10/,
qr/index out of bounds on offset 360: can't read 1, only has: 360/,
'this test uses a crafted consent uses range section, declares 10 vendors, 6 exceptions and legitimate interest without require';


Expand Down
26 changes: 26 additions & 0 deletions t/03-bugs.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
use strict;
use warnings;

use Test::More;
use Test::Exception;

use GDPR::IAB::TCFv2;

subtest
"BUG index out of bounds on offset, see: https://github.com/peczenyj/GDPR-IAB-TCFv2/issues/20"
=> sub {
my $consent;

my $tc_string =
'CP00b0AP00b0AAHABBENAbEsAP_AAH_AAAAAg1NX_G__bW9r8Xr3aft0eY1P99i77uQxBBXJE-4FyDvW_JwXx2EwJA26tqIKmRIEszZBIQFlHJHURVigSogVryHsYkGMgTNKJ6BkgFMRI2dYCExvmYtjeQKY5fp9d3fx2D-o_Nv83dzzz8lHn3d5P2UkcKCdQ58tDfntTRKb-5IOd-bcn4t08l_rk2fWRVn_pMtj7Beudl073XU61_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEQaoZgACIAFAAXAA4AD4AKAAqABcADkAHgAgABIAC6AGAAZQA0ADUAHgAPwAiABHACYAFCAKQApgBVgC4ALoAYgAzABoADeAHoAPwAhABDQCIAIkARwAlgBNACcAFGAKUAYAAw4BlAGWANEAbIA5ABzwDuAO8AewA-IB9gH7AP8BAICDgIQAREAikBFgEYAI1ARwBHQCRAElAJSATsAn4BQYCoAKiAVcAsQBcwC6wF5AXoAvoBigDRAGvANoAbgA4gBxwDpAHUAO2Ae0A-wB_wETAIvAR7AkQCRQEqAJWATFAmQCZQE2gJ2AUPAo8CkQFJwKaApsBT4CoYFSAVKAqoBVgCuQFdgLCgWIBYoCygFogLUAWxAtwC3QFwALkAXQAu0Bd8C8gLzAX0Av8BggDBgGGgMQAYsAx4BkMDIwMkgZMBk4DKgGWAMzAZyAzwBokDRgNHAaaA1MBqsDVwNZAa8A2iBtwG3gNygboBuoDgAHBAOLAceA5OBywHLgOfAeKA8eB5IHlAPigfIB8oD6QH1wPtA-6B-wH7gQBAgIBAwCB4EEQIJgQYAg2BCECFAEK4IWghcBDECGcEOQQ6gh4CHoEPwIpgRgAjSBGsCN4EcQI6AR2Aj2BH0CP4EhAJFASNgkgCScEmASZglQCVIEsAJZwS3BLiCXQJdgS-AmABMMCYsEzATOAmoBNiCbYJuATeCDUAUSAAwABEGoMABgACINQoADAAEQaigAGAAIg1DgAMAARBqCAAYAAiDUQAAwABEGoQABgACINQwADAAEQaiwAGAAIg1AAA.f_gAD_gAAAAA';
lives_ok {
$consent = GDPR::IAB::TCFv2->Parse($tc_string);
}
'should not throw exception';

isa_ok $consent, 'GDPR::IAB::TCFv2', 'gdpr iab tcf v2 consent';

done_testing;
};

done_testing;

0 comments on commit 4847709

Please sign in to comment.