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

proto: StartGroup #135

Open
3052 opened this issue Nov 22, 2023 · 1 comment
Open

proto: StartGroup #135

3052 opened this issue Nov 22, 2023 · 1 comment

Comments

@3052
Copy link

3052 commented Nov 22, 2023

I see that StartGroup is not defined:

encoding/proto/message.go

Lines 142 to 149 in 101dc9c

Varint WireType = 0
Fixed64 WireType = 1
Varlen WireType = 2
Fixed32 WireType = 5
// Wire types 3 and 4 were used for StartGroup and EndGroup, but are
// deprecated so we don't expose them here.
//
// https://developers.google.com/protocol-buffers/docs/encoding#structure

I think this is a problem, as some servers are still using it, for example android.clients.google.com.

@3052
Copy link
Author

3052 commented Nov 22, 2023

Here is example program to demonstrate the problem:

package main
import "github.com/segmentio/encoding/proto"

var buf = []byte("\n\tPinterest\x18\x88\x80\xbd\x04\"\x069.38.0H\xb6Ƃ\x12R'android.permission.ACCESS_FINE_LOCATIONR'android.permission.ACCESS_NETWORK_STATER$android.permission.ACCESS_WIFI_STATER\x19android.permission.CAMERAR%android.permission.FOREGROUND_SERVICER\x1fandroid.permission.GET_ACCOUNTSR\x1bandroid.permission.INTERNETR\x16android.permission.NFCR android.permission.READ_CONTACTSR(android.permission.READ_EXTERNAL_STORAGER\x1fandroid.permission.READ_PROFILER)android.permission.RECEIVE_BOOT_COMPLETEDR\x1fandroid.permission.RECORD_AUDIOR android.permission.SET_WALLPAPERR\"android.permission.USE_CREDENTIALSR\x1aandroid.permission.VIBRATER\x1candroid.permission.WAKE_LOCKR)android.permission.WRITE_EXTERNAL_STORAGER*com.google.android.c2dm.permission.RECEIVERFcom.google.android.finsky.permission.BIND_GET_INSTALL_REFERRER_SERVICER:com.google.android.providers.gsf.permission.READ_GSERVICESR.com.sec.android.provider.badge.permission.READR/com.sec.android.provider.badge.permission.WRITEZ\x12help@pinterest.comb\x1ahttps://help.pinterest.comj\f500,000,000+r\rcom.pinterestz\x9e\x01Every week we polish up the Pinterest app to make it faster and better than ever. Tell us if you like this newest version at http://help.pinterest.com/contact\x82\x01\vNov 4, 2021\x8a\x01\f\b\x00\x10\x88\x80\xbd\x04\x18\x98\x94\xdb\t\x8a\x01\x18\b\x00\x10\x88\x80\xbd\x04\x18ך7\"\vconfig.ldpi\x8a\x01\x16\b\x00\x10\x88\x80\xbd\x04\x18\x99\x83.\"\tconfig.en\x8a\x01 \b\x00\x10\x88\x80\xbd\x04\x18\xae\x94\xc2\a\"\x12config.armeabi_v7a\xa8\x01\x01\xf2\x01\fContains ads\x92\x02\xb9\x02\x10\xb6Ƃ\x12\x1a#\n\x16com.google.android.gms\x10\xb8\xf9\xf7\x05 \x01(\x000\x01\x1a\x1d\n\x12com.google.ar.core\x10\x90\x88\x8ce(\x010\x02 \x1e(\x03P\x02Z\vconfig.ldpiZ\tconfig.enZ\x12config.armeabi_v7a\x8a\x01\xba\x01\n\xb7\x01AB-xQnrRjA2gOewRVcyJK8QVgDaEb9DrMSv_o5YK27xm4VQ55WGxNAm2hsEYREBVIe5Ja-VbVcukaq65AYBjwBCKHYXO76UTsel3YOHKrEygYroA7MpW5KvRV-s2onK8UkiulWIACDI1aftBYiQXO8UwKI2NF3JO0btX78F9tUfJ3KAFQYMYdfE\x9a\x02\x93\x01\x10\x00\x18\x00\b\x012~\b\x01*xhttps://play-lh.googleusercontent.com/DX5LZpc4SUuvYv2kLA31fi05liLQwizh4DbHYwQthmNP15rul46zG-aquf2Vaf3M9EeBIihWmCsyIWFSLQH\x01:\tPinterest@\x02\x9a\x01\x1btqdNvLiUsPc9jEhccusSR6jwJ8o\x80\x02\x1e\xf2\x02D\x12B\x1a)search?q=pub:Pinterest&o=0&c=3&ksm=1&sb=5P\x03Z\rpub:Pinterest\xf8\x01\x05\xb8\x03\x03\x82\x03\tLifestyle\xa8\x03\x80ʵ\xee\x01\xea\x03\x05500M+\x82\x04\x1c\n\fAug 14, 2012\x12\f\b\x98\x05\x10\xc0\x8b\xf6\x82\x02\x92\x04\x00\xa2\x04\v\n\tPinterest\xb0\x04\xd1\xd3¿\x02\xca\x04\b\n\x06\b\aB\x02\b\x03\xd2\x04\b\n\x06\b\aB\x02\b\x0e\xe2\x04\b\n\x06\b\aB\x02\b\x13\xea\x04\x04500M\xf2\x04\v500 million")

func main() {
   var appDetails struct {
      Version string `protobuf:"bytes,4"`
      Permission []string `protobuf:"bytes,10"`
   }
   proto.Unmarshal(buf, &appDetails)
}

Result:

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x14 pc=0xa20d78]
goroutine 1 [running]:
github.com/segmentio/encoding/internal/runtime_reflect.CopySlice(...)
        C:/Users/Steven/go/pkg/mod/github.com/segmentio/encoding@v0.2.23/internal/runtime_reflect/slice.go:36
github.com/segmentio/encoding/proto.growSlice({0xb07ba0, 0xab7be0}, 0xc0000764f0)
        C:/Users/Steven/go/pkg/mod/github.com/segmentio/encoding@v0.2.23/proto/slice.go:139 +0x89
github.com/segmentio/encoding/proto.sliceDecodeFuncOf.func1({0xbb739a, 0x20, 0x660}, 0xc0000764f0, 0x0)
        C:/Users/Steven/go/pkg/mod/github.com/segmentio/encoding@v0.2.23/proto/slice.go:108 +0x6d
github.com/segmentio/encoding/proto.structDecodeFuncOf.func1({0xbb7220, 0x7da, 0x7da}, 0xc0000764e0, 0x30)
        C:/Users/Steven/go/pkg/mod/github.com/segmentio/encoding@v0.2.23/proto/struct.go:402 +0x64e
github.com/segmentio/encoding/proto.Unmarshal({0xbb7220, 0x7da, 0x7da}, {0xab4be0, 0xc0000764e0})
        C:/Users/Steven/go/pkg/mod/github.com/segmentio/encoding@v0.2.23/proto/proto.go:49 +0x1d7

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

No branches or pull requests

1 participant