this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Lex updates for labels

+850 -582
+290 -161
api/atproto/cbor_gen.go
··· 37 37 } 38 38 39 39 // t.Cid (string) (string) 40 - if uint64(len("cid")) > cbg.MaxLength { 40 + if len("cid") > 1000000 { 41 41 return xerrors.Errorf("Value in field \"cid\" was too long") 42 42 } 43 43 ··· 48 48 return err 49 49 } 50 50 51 - if uint64(len(t.Cid)) > cbg.MaxLength { 51 + if len(t.Cid) > 1000000 { 52 52 return xerrors.Errorf("Value in field t.Cid was too long") 53 53 } 54 54 ··· 60 60 } 61 61 62 62 // t.Uri (string) (string) 63 - if uint64(len("uri")) > cbg.MaxLength { 63 + if len("uri") > 1000000 { 64 64 return xerrors.Errorf("Value in field \"uri\" was too long") 65 65 } 66 66 ··· 71 71 return err 72 72 } 73 73 74 - if uint64(len(t.Uri)) > cbg.MaxLength { 74 + if len(t.Uri) > 1000000 { 75 75 return xerrors.Errorf("Value in field t.Uri was too long") 76 76 } 77 77 ··· 85 85 // t.LexiconTypeID (string) (string) 86 86 if t.LexiconTypeID != "" { 87 87 88 - if uint64(len("$type")) > cbg.MaxLength { 88 + if len("$type") > 1000000 { 89 89 return xerrors.Errorf("Value in field \"$type\" was too long") 90 90 } 91 91 ··· 135 135 for i := uint64(0); i < n; i++ { 136 136 137 137 { 138 - sval, err := cbg.ReadString(cr) 138 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 139 139 if err != nil { 140 140 return err 141 141 } ··· 148 148 case "cid": 149 149 150 150 { 151 - sval, err := cbg.ReadString(cr) 151 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 152 152 if err != nil { 153 153 return err 154 154 } ··· 159 159 case "uri": 160 160 161 161 { 162 - sval, err := cbg.ReadString(cr) 162 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 163 163 if err != nil { 164 164 return err 165 165 } ··· 170 170 case "$type": 171 171 172 172 { 173 - sval, err := cbg.ReadString(cr) 173 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 174 174 if err != nil { 175 175 return err 176 176 } ··· 204 204 } 205 205 206 206 // t.Ops ([]*atproto.SyncSubscribeRepos_RepoOp) (slice) 207 - if uint64(len("ops")) > cbg.MaxLength { 207 + if len("ops") > 1000000 { 208 208 return xerrors.Errorf("Value in field \"ops\" was too long") 209 209 } 210 210 ··· 215 215 return err 216 216 } 217 217 218 - if uint64(len(t.Ops)) > cbg.MaxLength { 218 + if len(t.Ops) > 8192 { 219 219 return xerrors.Errorf("Slice value in field t.Ops was too long") 220 220 } 221 221 ··· 230 230 } 231 231 232 232 // t.Rev (string) (string) 233 - if uint64(len("rev")) > cbg.MaxLength { 233 + if len("rev") > 1000000 { 234 234 return xerrors.Errorf("Value in field \"rev\" was too long") 235 235 } 236 236 ··· 241 241 return err 242 242 } 243 243 244 - if uint64(len(t.Rev)) > cbg.MaxLength { 244 + if len(t.Rev) > 1000000 { 245 245 return xerrors.Errorf("Value in field t.Rev was too long") 246 246 } 247 247 ··· 253 253 } 254 254 255 255 // t.Seq (int64) (int64) 256 - if uint64(len("seq")) > cbg.MaxLength { 256 + if len("seq") > 1000000 { 257 257 return xerrors.Errorf("Value in field \"seq\" was too long") 258 258 } 259 259 ··· 275 275 } 276 276 277 277 // t.Prev (util.LexLink) (struct) 278 - if uint64(len("prev")) > cbg.MaxLength { 278 + if len("prev") > 1000000 { 279 279 return xerrors.Errorf("Value in field \"prev\" was too long") 280 280 } 281 281 ··· 291 291 } 292 292 293 293 // t.Repo (string) (string) 294 - if uint64(len("repo")) > cbg.MaxLength { 294 + if len("repo") > 1000000 { 295 295 return xerrors.Errorf("Value in field \"repo\" was too long") 296 296 } 297 297 ··· 302 302 return err 303 303 } 304 304 305 - if uint64(len(t.Repo)) > cbg.MaxLength { 305 + if len(t.Repo) > 1000000 { 306 306 return xerrors.Errorf("Value in field t.Repo was too long") 307 307 } 308 308 ··· 314 314 } 315 315 316 316 // t.Time (string) (string) 317 - if uint64(len("time")) > cbg.MaxLength { 317 + if len("time") > 1000000 { 318 318 return xerrors.Errorf("Value in field \"time\" was too long") 319 319 } 320 320 ··· 325 325 return err 326 326 } 327 327 328 - if uint64(len(t.Time)) > cbg.MaxLength { 328 + if len(t.Time) > 1000000 { 329 329 return xerrors.Errorf("Value in field t.Time was too long") 330 330 } 331 331 ··· 337 337 } 338 338 339 339 // t.Blobs ([]util.LexLink) (slice) 340 - if uint64(len("blobs")) > cbg.MaxLength { 340 + if len("blobs") > 1000000 { 341 341 return xerrors.Errorf("Value in field \"blobs\" was too long") 342 342 } 343 343 ··· 348 348 return err 349 349 } 350 350 351 - if uint64(len(t.Blobs)) > cbg.MaxLength { 351 + if len(t.Blobs) > 8192 { 352 352 return xerrors.Errorf("Slice value in field t.Blobs was too long") 353 353 } 354 354 ··· 363 363 } 364 364 365 365 // t.Since (string) (string) 366 - if uint64(len("since")) > cbg.MaxLength { 366 + if len("since") > 1000000 { 367 367 return xerrors.Errorf("Value in field \"since\" was too long") 368 368 } 369 369 ··· 379 379 return err 380 380 } 381 381 } else { 382 - if uint64(len(*t.Since)) > cbg.MaxLength { 382 + if len(*t.Since) > 1000000 { 383 383 return xerrors.Errorf("Value in field t.Since was too long") 384 384 } 385 385 ··· 394 394 // t.Blocks (util.LexBytes) (slice) 395 395 if t.Blocks != nil { 396 396 397 - if uint64(len("blocks")) > cbg.MaxLength { 397 + if len("blocks") > 1000000 { 398 398 return xerrors.Errorf("Value in field \"blocks\" was too long") 399 399 } 400 400 ··· 405 405 return err 406 406 } 407 407 408 - if uint64(len(t.Blocks)) > cbg.ByteArrayMaxLen { 408 + if len(t.Blocks) > 2097152 { 409 409 return xerrors.Errorf("Byte array in field t.Blocks was too long") 410 410 } 411 411 ··· 420 420 } 421 421 422 422 // t.Commit (util.LexLink) (struct) 423 - if uint64(len("commit")) > cbg.MaxLength { 423 + if len("commit") > 1000000 { 424 424 return xerrors.Errorf("Value in field \"commit\" was too long") 425 425 } 426 426 ··· 436 436 } 437 437 438 438 // t.Rebase (bool) (bool) 439 - if uint64(len("rebase")) > cbg.MaxLength { 439 + if len("rebase") > 1000000 { 440 440 return xerrors.Errorf("Value in field \"rebase\" was too long") 441 441 } 442 442 ··· 452 452 } 453 453 454 454 // t.TooBig (bool) (bool) 455 - if uint64(len("tooBig")) > cbg.MaxLength { 455 + if len("tooBig") > 1000000 { 456 456 return xerrors.Errorf("Value in field \"tooBig\" was too long") 457 457 } 458 458 ··· 498 498 for i := uint64(0); i < n; i++ { 499 499 500 500 { 501 - sval, err := cbg.ReadString(cr) 501 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 502 502 if err != nil { 503 503 return err 504 504 } ··· 515 515 return err 516 516 } 517 517 518 - if extra > cbg.MaxLength { 518 + if extra > 8192 { 519 519 return fmt.Errorf("t.Ops: array too large (%d)", extra) 520 520 } 521 521 ··· 560 560 case "rev": 561 561 562 562 { 563 - sval, err := cbg.ReadString(cr) 563 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 564 564 if err != nil { 565 565 return err 566 566 } ··· 571 571 case "seq": 572 572 { 573 573 maj, extra, err := cr.ReadHeader() 574 - var extraI int64 575 574 if err != nil { 576 575 return err 577 576 } 577 + var extraI int64 578 578 switch maj { 579 579 case cbg.MajUnsignedInt: 580 580 extraI = int64(extra) ··· 617 617 case "repo": 618 618 619 619 { 620 - sval, err := cbg.ReadString(cr) 620 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 621 621 if err != nil { 622 622 return err 623 623 } ··· 628 628 case "time": 629 629 630 630 { 631 - sval, err := cbg.ReadString(cr) 631 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 632 632 if err != nil { 633 633 return err 634 634 } ··· 643 643 return err 644 644 } 645 645 646 - if extra > cbg.MaxLength { 646 + if extra > 8192 { 647 647 return fmt.Errorf("t.Blobs: array too large (%d)", extra) 648 648 } 649 649 ··· 687 687 return err 688 688 } 689 689 690 - sval, err := cbg.ReadString(cr) 690 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 691 691 if err != nil { 692 692 return err 693 693 } ··· 703 703 return err 704 704 } 705 705 706 - if extra > cbg.ByteArrayMaxLen { 706 + if extra > 2097152 { 707 707 return fmt.Errorf("t.Blocks: byte array too large (%d)", extra) 708 708 } 709 709 if maj != cbg.MajByteString { ··· 786 786 } 787 787 788 788 // t.Did (string) (string) 789 - if uint64(len("did")) > cbg.MaxLength { 789 + if len("did") > 1000000 { 790 790 return xerrors.Errorf("Value in field \"did\" was too long") 791 791 } 792 792 ··· 797 797 return err 798 798 } 799 799 800 - if uint64(len(t.Did)) > cbg.MaxLength { 800 + if len(t.Did) > 1000000 { 801 801 return xerrors.Errorf("Value in field t.Did was too long") 802 802 } 803 803 ··· 809 809 } 810 810 811 811 // t.Seq (int64) (int64) 812 - if uint64(len("seq")) > cbg.MaxLength { 812 + if len("seq") > 1000000 { 813 813 return xerrors.Errorf("Value in field \"seq\" was too long") 814 814 } 815 815 ··· 831 831 } 832 832 833 833 // t.Time (string) (string) 834 - if uint64(len("time")) > cbg.MaxLength { 834 + if len("time") > 1000000 { 835 835 return xerrors.Errorf("Value in field \"time\" was too long") 836 836 } 837 837 ··· 842 842 return err 843 843 } 844 844 845 - if uint64(len(t.Time)) > cbg.MaxLength { 845 + if len(t.Time) > 1000000 { 846 846 return xerrors.Errorf("Value in field t.Time was too long") 847 847 } 848 848 ··· 854 854 } 855 855 856 856 // t.Handle (string) (string) 857 - if uint64(len("handle")) > cbg.MaxLength { 857 + if len("handle") > 1000000 { 858 858 return xerrors.Errorf("Value in field \"handle\" was too long") 859 859 } 860 860 ··· 865 865 return err 866 866 } 867 867 868 - if uint64(len(t.Handle)) > cbg.MaxLength { 868 + if len(t.Handle) > 1000000 { 869 869 return xerrors.Errorf("Value in field t.Handle was too long") 870 870 } 871 871 ··· 907 907 for i := uint64(0); i < n; i++ { 908 908 909 909 { 910 - sval, err := cbg.ReadString(cr) 910 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 911 911 if err != nil { 912 912 return err 913 913 } ··· 920 920 case "did": 921 921 922 922 { 923 - sval, err := cbg.ReadString(cr) 923 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 924 924 if err != nil { 925 925 return err 926 926 } ··· 931 931 case "seq": 932 932 { 933 933 maj, extra, err := cr.ReadHeader() 934 - var extraI int64 935 934 if err != nil { 936 935 return err 937 936 } 937 + var extraI int64 938 938 switch maj { 939 939 case cbg.MajUnsignedInt: 940 940 extraI = int64(extra) ··· 957 957 case "time": 958 958 959 959 { 960 - sval, err := cbg.ReadString(cr) 960 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 961 961 if err != nil { 962 962 return err 963 963 } ··· 968 968 case "handle": 969 969 970 970 { 971 - sval, err := cbg.ReadString(cr) 971 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 972 972 if err != nil { 973 973 return err 974 974 } ··· 997 997 } 998 998 999 999 // t.Did (string) (string) 1000 - if uint64(len("did")) > cbg.MaxLength { 1000 + if len("did") > 1000000 { 1001 1001 return xerrors.Errorf("Value in field \"did\" was too long") 1002 1002 } 1003 1003 ··· 1008 1008 return err 1009 1009 } 1010 1010 1011 - if uint64(len(t.Did)) > cbg.MaxLength { 1011 + if len(t.Did) > 1000000 { 1012 1012 return xerrors.Errorf("Value in field t.Did was too long") 1013 1013 } 1014 1014 ··· 1020 1020 } 1021 1021 1022 1022 // t.Seq (int64) (int64) 1023 - if uint64(len("seq")) > cbg.MaxLength { 1023 + if len("seq") > 1000000 { 1024 1024 return xerrors.Errorf("Value in field \"seq\" was too long") 1025 1025 } 1026 1026 ··· 1042 1042 } 1043 1043 1044 1044 // t.Time (string) (string) 1045 - if uint64(len("time")) > cbg.MaxLength { 1045 + if len("time") > 1000000 { 1046 1046 return xerrors.Errorf("Value in field \"time\" was too long") 1047 1047 } 1048 1048 ··· 1053 1053 return err 1054 1054 } 1055 1055 1056 - if uint64(len(t.Time)) > cbg.MaxLength { 1056 + if len(t.Time) > 1000000 { 1057 1057 return xerrors.Errorf("Value in field t.Time was too long") 1058 1058 } 1059 1059 ··· 1095 1095 for i := uint64(0); i < n; i++ { 1096 1096 1097 1097 { 1098 - sval, err := cbg.ReadString(cr) 1098 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 1099 1099 if err != nil { 1100 1100 return err 1101 1101 } ··· 1108 1108 case "did": 1109 1109 1110 1110 { 1111 - sval, err := cbg.ReadString(cr) 1111 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 1112 1112 if err != nil { 1113 1113 return err 1114 1114 } ··· 1119 1119 case "seq": 1120 1120 { 1121 1121 maj, extra, err := cr.ReadHeader() 1122 - var extraI int64 1123 1122 if err != nil { 1124 1123 return err 1125 1124 } 1125 + var extraI int64 1126 1126 switch maj { 1127 1127 case cbg.MajUnsignedInt: 1128 1128 extraI = int64(extra) ··· 1145 1145 case "time": 1146 1146 1147 1147 { 1148 - sval, err := cbg.ReadString(cr) 1148 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 1149 1149 if err != nil { 1150 1150 return err 1151 1151 } ··· 1179 1179 } 1180 1180 1181 1181 // t.Name (string) (string) 1182 - if uint64(len("name")) > cbg.MaxLength { 1182 + if len("name") > 1000000 { 1183 1183 return xerrors.Errorf("Value in field \"name\" was too long") 1184 1184 } 1185 1185 ··· 1190 1190 return err 1191 1191 } 1192 1192 1193 - if uint64(len(t.Name)) > cbg.MaxLength { 1193 + if len(t.Name) > 1000000 { 1194 1194 return xerrors.Errorf("Value in field t.Name was too long") 1195 1195 } 1196 1196 ··· 1204 1204 // t.Message (string) (string) 1205 1205 if t.Message != nil { 1206 1206 1207 - if uint64(len("message")) > cbg.MaxLength { 1207 + if len("message") > 1000000 { 1208 1208 return xerrors.Errorf("Value in field \"message\" was too long") 1209 1209 } 1210 1210 ··· 1220 1220 return err 1221 1221 } 1222 1222 } else { 1223 - if uint64(len(*t.Message)) > cbg.MaxLength { 1223 + if len(*t.Message) > 1000000 { 1224 1224 return xerrors.Errorf("Value in field t.Message was too long") 1225 1225 } 1226 1226 ··· 1264 1264 for i := uint64(0); i < n; i++ { 1265 1265 1266 1266 { 1267 - sval, err := cbg.ReadString(cr) 1267 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 1268 1268 if err != nil { 1269 1269 return err 1270 1270 } ··· 1277 1277 case "name": 1278 1278 1279 1279 { 1280 - sval, err := cbg.ReadString(cr) 1280 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 1281 1281 if err != nil { 1282 1282 return err 1283 1283 } ··· 1297 1297 return err 1298 1298 } 1299 1299 1300 - sval, err := cbg.ReadString(cr) 1300 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 1301 1301 if err != nil { 1302 1302 return err 1303 1303 } ··· 1327 1327 } 1328 1328 1329 1329 // t.Did (string) (string) 1330 - if uint64(len("did")) > cbg.MaxLength { 1330 + if len("did") > 1000000 { 1331 1331 return xerrors.Errorf("Value in field \"did\" was too long") 1332 1332 } 1333 1333 ··· 1338 1338 return err 1339 1339 } 1340 1340 1341 - if uint64(len(t.Did)) > cbg.MaxLength { 1341 + if len(t.Did) > 1000000 { 1342 1342 return xerrors.Errorf("Value in field t.Did was too long") 1343 1343 } 1344 1344 ··· 1350 1350 } 1351 1351 1352 1352 // t.Seq (int64) (int64) 1353 - if uint64(len("seq")) > cbg.MaxLength { 1353 + if len("seq") > 1000000 { 1354 1354 return xerrors.Errorf("Value in field \"seq\" was too long") 1355 1355 } 1356 1356 ··· 1372 1372 } 1373 1373 1374 1374 // t.Time (string) (string) 1375 - if uint64(len("time")) > cbg.MaxLength { 1375 + if len("time") > 1000000 { 1376 1376 return xerrors.Errorf("Value in field \"time\" was too long") 1377 1377 } 1378 1378 ··· 1383 1383 return err 1384 1384 } 1385 1385 1386 - if uint64(len(t.Time)) > cbg.MaxLength { 1386 + if len(t.Time) > 1000000 { 1387 1387 return xerrors.Errorf("Value in field t.Time was too long") 1388 1388 } 1389 1389 ··· 1395 1395 } 1396 1396 1397 1397 // t.MigrateTo (string) (string) 1398 - if uint64(len("migrateTo")) > cbg.MaxLength { 1398 + if len("migrateTo") > 1000000 { 1399 1399 return xerrors.Errorf("Value in field \"migrateTo\" was too long") 1400 1400 } 1401 1401 ··· 1411 1411 return err 1412 1412 } 1413 1413 } else { 1414 - if uint64(len(*t.MigrateTo)) > cbg.MaxLength { 1414 + if len(*t.MigrateTo) > 1000000 { 1415 1415 return xerrors.Errorf("Value in field t.MigrateTo was too long") 1416 1416 } 1417 1417 ··· 1454 1454 for i := uint64(0); i < n; i++ { 1455 1455 1456 1456 { 1457 - sval, err := cbg.ReadString(cr) 1457 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 1458 1458 if err != nil { 1459 1459 return err 1460 1460 } ··· 1467 1467 case "did": 1468 1468 1469 1469 { 1470 - sval, err := cbg.ReadString(cr) 1470 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 1471 1471 if err != nil { 1472 1472 return err 1473 1473 } ··· 1478 1478 case "seq": 1479 1479 { 1480 1480 maj, extra, err := cr.ReadHeader() 1481 - var extraI int64 1482 1481 if err != nil { 1483 1482 return err 1484 1483 } 1484 + var extraI int64 1485 1485 switch maj { 1486 1486 case cbg.MajUnsignedInt: 1487 1487 extraI = int64(extra) ··· 1504 1504 case "time": 1505 1505 1506 1506 { 1507 - sval, err := cbg.ReadString(cr) 1507 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 1508 1508 if err != nil { 1509 1509 return err 1510 1510 } ··· 1524 1524 return err 1525 1525 } 1526 1526 1527 - sval, err := cbg.ReadString(cr) 1527 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 1528 1528 if err != nil { 1529 1529 return err 1530 1530 } ··· 1554 1554 } 1555 1555 1556 1556 // t.Cid (util.LexLink) (struct) 1557 - if uint64(len("cid")) > cbg.MaxLength { 1557 + if len("cid") > 1000000 { 1558 1558 return xerrors.Errorf("Value in field \"cid\" was too long") 1559 1559 } 1560 1560 ··· 1570 1570 } 1571 1571 1572 1572 // t.Path (string) (string) 1573 - if uint64(len("path")) > cbg.MaxLength { 1573 + if len("path") > 1000000 { 1574 1574 return xerrors.Errorf("Value in field \"path\" was too long") 1575 1575 } 1576 1576 ··· 1581 1581 return err 1582 1582 } 1583 1583 1584 - if uint64(len(t.Path)) > cbg.MaxLength { 1584 + if len(t.Path) > 1000000 { 1585 1585 return xerrors.Errorf("Value in field t.Path was too long") 1586 1586 } 1587 1587 ··· 1593 1593 } 1594 1594 1595 1595 // t.Action (string) (string) 1596 - if uint64(len("action")) > cbg.MaxLength { 1596 + if len("action") > 1000000 { 1597 1597 return xerrors.Errorf("Value in field \"action\" was too long") 1598 1598 } 1599 1599 ··· 1604 1604 return err 1605 1605 } 1606 1606 1607 - if uint64(len(t.Action)) > cbg.MaxLength { 1607 + if len(t.Action) > 1000000 { 1608 1608 return xerrors.Errorf("Value in field t.Action was too long") 1609 1609 } 1610 1610 ··· 1646 1646 for i := uint64(0); i < n; i++ { 1647 1647 1648 1648 { 1649 - sval, err := cbg.ReadString(cr) 1649 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 1650 1650 if err != nil { 1651 1651 return err 1652 1652 } ··· 1679 1679 case "path": 1680 1680 1681 1681 { 1682 - sval, err := cbg.ReadString(cr) 1682 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 1683 1683 if err != nil { 1684 1684 return err 1685 1685 } ··· 1690 1690 case "action": 1691 1691 1692 1692 { 1693 - sval, err := cbg.ReadString(cr) 1693 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 1694 1694 if err != nil { 1695 1695 return err 1696 1696 } ··· 1719 1719 } 1720 1720 1721 1721 // t.Did (string) (string) 1722 - if uint64(len("did")) > cbg.MaxLength { 1722 + if len("did") > 1000000 { 1723 1723 return xerrors.Errorf("Value in field \"did\" was too long") 1724 1724 } 1725 1725 ··· 1730 1730 return err 1731 1731 } 1732 1732 1733 - if uint64(len(t.Did)) > cbg.MaxLength { 1733 + if len(t.Did) > 1000000 { 1734 1734 return xerrors.Errorf("Value in field t.Did was too long") 1735 1735 } 1736 1736 ··· 1742 1742 } 1743 1743 1744 1744 // t.Seq (int64) (int64) 1745 - if uint64(len("seq")) > cbg.MaxLength { 1745 + if len("seq") > 1000000 { 1746 1746 return xerrors.Errorf("Value in field \"seq\" was too long") 1747 1747 } 1748 1748 ··· 1764 1764 } 1765 1765 1766 1766 // t.Time (string) (string) 1767 - if uint64(len("time")) > cbg.MaxLength { 1767 + if len("time") > 1000000 { 1768 1768 return xerrors.Errorf("Value in field \"time\" was too long") 1769 1769 } 1770 1770 ··· 1775 1775 return err 1776 1776 } 1777 1777 1778 - if uint64(len(t.Time)) > cbg.MaxLength { 1778 + if len(t.Time) > 1000000 { 1779 1779 return xerrors.Errorf("Value in field t.Time was too long") 1780 1780 } 1781 1781 ··· 1817 1817 for i := uint64(0); i < n; i++ { 1818 1818 1819 1819 { 1820 - sval, err := cbg.ReadString(cr) 1820 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 1821 1821 if err != nil { 1822 1822 return err 1823 1823 } ··· 1830 1830 case "did": 1831 1831 1832 1832 { 1833 - sval, err := cbg.ReadString(cr) 1833 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 1834 1834 if err != nil { 1835 1835 return err 1836 1836 } ··· 1841 1841 case "seq": 1842 1842 { 1843 1843 maj, extra, err := cr.ReadHeader() 1844 - var extraI int64 1845 1844 if err != nil { 1846 1845 return err 1847 1846 } 1847 + var extraI int64 1848 1848 switch maj { 1849 1849 case cbg.MajUnsignedInt: 1850 1850 extraI = int64(extra) ··· 1867 1867 case "time": 1868 1868 1869 1869 { 1870 - sval, err := cbg.ReadString(cr) 1870 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 1871 1871 if err != nil { 1872 1872 return err 1873 1873 } ··· 1896 1896 } 1897 1897 1898 1898 // t.LexiconTypeID (string) (string) 1899 - if uint64(len("$type")) > cbg.MaxLength { 1899 + if len("$type") > 1000000 { 1900 1900 return xerrors.Errorf("Value in field \"$type\" was too long") 1901 1901 } 1902 1902 ··· 1915 1915 } 1916 1916 1917 1917 // t.Values ([]*atproto.LabelDefs_SelfLabel) (slice) 1918 - if uint64(len("values")) > cbg.MaxLength { 1918 + if len("values") > 1000000 { 1919 1919 return xerrors.Errorf("Value in field \"values\" was too long") 1920 1920 } 1921 1921 ··· 1926 1926 return err 1927 1927 } 1928 1928 1929 - if uint64(len(t.Values)) > cbg.MaxLength { 1929 + if len(t.Values) > 8192 { 1930 1930 return xerrors.Errorf("Slice value in field t.Values was too long") 1931 1931 } 1932 1932 ··· 1980 1980 for i := uint64(0); i < n; i++ { 1981 1981 1982 1982 { 1983 - sval, err := cbg.ReadString(cr) 1983 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 1984 1984 if err != nil { 1985 1985 return err 1986 1986 } ··· 1993 1993 case "$type": 1994 1994 1995 1995 { 1996 - sval, err := cbg.ReadString(cr) 1996 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 1997 1997 if err != nil { 1998 1998 return err 1999 1999 } ··· 2018 2018 return err 2019 2019 } 2020 2020 2021 - if extra > cbg.MaxLength { 2021 + if extra > 8192 { 2022 2022 return fmt.Errorf("t.Values: array too large (%d)", extra) 2023 2023 } 2024 2024 ··· 2082 2082 } 2083 2083 2084 2084 // t.Val (string) (string) 2085 - if uint64(len("val")) > cbg.MaxLength { 2085 + if len("val") > 1000000 { 2086 2086 return xerrors.Errorf("Value in field \"val\" was too long") 2087 2087 } 2088 2088 ··· 2093 2093 return err 2094 2094 } 2095 2095 2096 - if uint64(len(t.Val)) > cbg.MaxLength { 2096 + if len(t.Val) > 1000000 { 2097 2097 return xerrors.Errorf("Value in field t.Val was too long") 2098 2098 } 2099 2099 ··· 2135 2135 for i := uint64(0); i < n; i++ { 2136 2136 2137 2137 { 2138 - sval, err := cbg.ReadString(cr) 2138 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 2139 2139 if err != nil { 2140 2140 return err 2141 2141 } ··· 2148 2148 case "val": 2149 2149 2150 2150 { 2151 - sval, err := cbg.ReadString(cr) 2151 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 2152 2152 if err != nil { 2153 2153 return err 2154 2154 } ··· 2171 2171 } 2172 2172 2173 2173 cw := cbg.NewCborWriter(w) 2174 - fieldCount := 7 2174 + fieldCount := 9 2175 2175 2176 2176 if t.Cid == nil { 2177 2177 fieldCount-- 2178 2178 } 2179 2179 2180 + if t.Exp == nil { 2181 + fieldCount-- 2182 + } 2183 + 2180 2184 if t.Neg == nil { 2181 2185 fieldCount-- 2182 2186 } ··· 2185 2189 fieldCount-- 2186 2190 } 2187 2191 2192 + if t.Ver == nil { 2193 + fieldCount-- 2194 + } 2195 + 2188 2196 if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil { 2189 2197 return err 2190 2198 } ··· 2192 2200 // t.Cid (string) (string) 2193 2201 if t.Cid != nil { 2194 2202 2195 - if uint64(len("cid")) > cbg.MaxLength { 2203 + if len("cid") > 1000000 { 2196 2204 return xerrors.Errorf("Value in field \"cid\" was too long") 2197 2205 } 2198 2206 ··· 2208 2216 return err 2209 2217 } 2210 2218 } else { 2211 - if uint64(len(*t.Cid)) > cbg.MaxLength { 2219 + if len(*t.Cid) > 1000000 { 2212 2220 return xerrors.Errorf("Value in field t.Cid was too long") 2213 2221 } 2214 2222 ··· 2222 2230 } 2223 2231 2224 2232 // t.Cts (string) (string) 2225 - if uint64(len("cts")) > cbg.MaxLength { 2233 + if len("cts") > 1000000 { 2226 2234 return xerrors.Errorf("Value in field \"cts\" was too long") 2227 2235 } 2228 2236 ··· 2233 2241 return err 2234 2242 } 2235 2243 2236 - if uint64(len(t.Cts)) > cbg.MaxLength { 2244 + if len(t.Cts) > 1000000 { 2237 2245 return xerrors.Errorf("Value in field t.Cts was too long") 2238 2246 } 2239 2247 ··· 2244 2252 return err 2245 2253 } 2246 2254 2255 + // t.Exp (string) (string) 2256 + if t.Exp != nil { 2257 + 2258 + if len("exp") > 1000000 { 2259 + return xerrors.Errorf("Value in field \"exp\" was too long") 2260 + } 2261 + 2262 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("exp"))); err != nil { 2263 + return err 2264 + } 2265 + if _, err := cw.WriteString(string("exp")); err != nil { 2266 + return err 2267 + } 2268 + 2269 + if t.Exp == nil { 2270 + if _, err := cw.Write(cbg.CborNull); err != nil { 2271 + return err 2272 + } 2273 + } else { 2274 + if len(*t.Exp) > 1000000 { 2275 + return xerrors.Errorf("Value in field t.Exp was too long") 2276 + } 2277 + 2278 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Exp))); err != nil { 2279 + return err 2280 + } 2281 + if _, err := cw.WriteString(string(*t.Exp)); err != nil { 2282 + return err 2283 + } 2284 + } 2285 + } 2286 + 2247 2287 // t.Neg (bool) (bool) 2248 2288 if t.Neg != nil { 2249 2289 2250 - if uint64(len("neg")) > cbg.MaxLength { 2290 + if len("neg") > 1000000 { 2251 2291 return xerrors.Errorf("Value in field \"neg\" was too long") 2252 2292 } 2253 2293 ··· 2272 2312 // t.Sig (util.LexBytes) (slice) 2273 2313 if t.Sig != nil { 2274 2314 2275 - if uint64(len("sig")) > cbg.MaxLength { 2315 + if len("sig") > 1000000 { 2276 2316 return xerrors.Errorf("Value in field \"sig\" was too long") 2277 2317 } 2278 2318 ··· 2283 2323 return err 2284 2324 } 2285 2325 2286 - if uint64(len(t.Sig)) > cbg.ByteArrayMaxLen { 2326 + if len(t.Sig) > 2097152 { 2287 2327 return xerrors.Errorf("Byte array in field t.Sig was too long") 2288 2328 } 2289 2329 ··· 2298 2338 } 2299 2339 2300 2340 // t.Src (string) (string) 2301 - if uint64(len("src")) > cbg.MaxLength { 2341 + if len("src") > 1000000 { 2302 2342 return xerrors.Errorf("Value in field \"src\" was too long") 2303 2343 } 2304 2344 ··· 2309 2349 return err 2310 2350 } 2311 2351 2312 - if uint64(len(t.Src)) > cbg.MaxLength { 2352 + if len(t.Src) > 1000000 { 2313 2353 return xerrors.Errorf("Value in field t.Src was too long") 2314 2354 } 2315 2355 ··· 2321 2361 } 2322 2362 2323 2363 // t.Uri (string) (string) 2324 - if uint64(len("uri")) > cbg.MaxLength { 2364 + if len("uri") > 1000000 { 2325 2365 return xerrors.Errorf("Value in field \"uri\" was too long") 2326 2366 } 2327 2367 ··· 2332 2372 return err 2333 2373 } 2334 2374 2335 - if uint64(len(t.Uri)) > cbg.MaxLength { 2375 + if len(t.Uri) > 1000000 { 2336 2376 return xerrors.Errorf("Value in field t.Uri was too long") 2337 2377 } 2338 2378 ··· 2344 2384 } 2345 2385 2346 2386 // t.Val (string) (string) 2347 - if uint64(len("val")) > cbg.MaxLength { 2387 + if len("val") > 1000000 { 2348 2388 return xerrors.Errorf("Value in field \"val\" was too long") 2349 2389 } 2350 2390 ··· 2355 2395 return err 2356 2396 } 2357 2397 2358 - if uint64(len(t.Val)) > cbg.MaxLength { 2398 + if len(t.Val) > 1000000 { 2359 2399 return xerrors.Errorf("Value in field t.Val was too long") 2360 2400 } 2361 2401 ··· 2365 2405 if _, err := cw.WriteString(string(t.Val)); err != nil { 2366 2406 return err 2367 2407 } 2408 + 2409 + // t.Ver (int64) (int64) 2410 + if t.Ver != nil { 2411 + 2412 + if len("ver") > 1000000 { 2413 + return xerrors.Errorf("Value in field \"ver\" was too long") 2414 + } 2415 + 2416 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("ver"))); err != nil { 2417 + return err 2418 + } 2419 + if _, err := cw.WriteString(string("ver")); err != nil { 2420 + return err 2421 + } 2422 + 2423 + if t.Ver == nil { 2424 + if _, err := cw.Write(cbg.CborNull); err != nil { 2425 + return err 2426 + } 2427 + } else { 2428 + if *t.Ver >= 0 { 2429 + if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(*t.Ver)); err != nil { 2430 + return err 2431 + } 2432 + } else { 2433 + if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-*t.Ver-1)); err != nil { 2434 + return err 2435 + } 2436 + } 2437 + } 2438 + 2439 + } 2368 2440 return nil 2369 2441 } 2370 2442 ··· 2397 2469 for i := uint64(0); i < n; i++ { 2398 2470 2399 2471 { 2400 - sval, err := cbg.ReadString(cr) 2472 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 2401 2473 if err != nil { 2402 2474 return err 2403 2475 } ··· 2419 2491 return err 2420 2492 } 2421 2493 2422 - sval, err := cbg.ReadString(cr) 2494 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 2423 2495 if err != nil { 2424 2496 return err 2425 2497 } ··· 2431 2503 case "cts": 2432 2504 2433 2505 { 2434 - sval, err := cbg.ReadString(cr) 2506 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 2435 2507 if err != nil { 2436 2508 return err 2437 2509 } 2438 2510 2439 2511 t.Cts = string(sval) 2440 2512 } 2513 + // t.Exp (string) (string) 2514 + case "exp": 2515 + 2516 + { 2517 + b, err := cr.ReadByte() 2518 + if err != nil { 2519 + return err 2520 + } 2521 + if b != cbg.CborNull[0] { 2522 + if err := cr.UnreadByte(); err != nil { 2523 + return err 2524 + } 2525 + 2526 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 2527 + if err != nil { 2528 + return err 2529 + } 2530 + 2531 + t.Exp = (*string)(&sval) 2532 + } 2533 + } 2441 2534 // t.Neg (bool) (bool) 2442 2535 case "neg": 2443 2536 ··· 2479 2572 return err 2480 2573 } 2481 2574 2482 - if extra > cbg.ByteArrayMaxLen { 2575 + if extra > 2097152 { 2483 2576 return fmt.Errorf("t.Sig: byte array too large (%d)", extra) 2484 2577 } 2485 2578 if maj != cbg.MajByteString { ··· 2498 2591 case "src": 2499 2592 2500 2593 { 2501 - sval, err := cbg.ReadString(cr) 2594 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 2502 2595 if err != nil { 2503 2596 return err 2504 2597 } ··· 2509 2602 case "uri": 2510 2603 2511 2604 { 2512 - sval, err := cbg.ReadString(cr) 2605 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 2513 2606 if err != nil { 2514 2607 return err 2515 2608 } ··· 2520 2613 case "val": 2521 2614 2522 2615 { 2523 - sval, err := cbg.ReadString(cr) 2616 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 2524 2617 if err != nil { 2525 2618 return err 2526 2619 } 2527 2620 2528 2621 t.Val = string(sval) 2529 2622 } 2623 + // t.Ver (int64) (int64) 2624 + case "ver": 2625 + { 2626 + 2627 + b, err := cr.ReadByte() 2628 + if err != nil { 2629 + return err 2630 + } 2631 + if b != cbg.CborNull[0] { 2632 + if err := cr.UnreadByte(); err != nil { 2633 + return err 2634 + } 2635 + maj, extra, err := cr.ReadHeader() 2636 + if err != nil { 2637 + return err 2638 + } 2639 + var extraI int64 2640 + switch maj { 2641 + case cbg.MajUnsignedInt: 2642 + extraI = int64(extra) 2643 + if extraI < 0 { 2644 + return fmt.Errorf("int64 positive overflow") 2645 + } 2646 + case cbg.MajNegativeInt: 2647 + extraI = int64(extra) 2648 + if extraI < 0 { 2649 + return fmt.Errorf("int64 negative overflow") 2650 + } 2651 + extraI = -1 - extraI 2652 + default: 2653 + return fmt.Errorf("wrong type for int64 field: %d", maj) 2654 + } 2655 + 2656 + t.Ver = (*int64)(&extraI) 2657 + } 2658 + } 2530 2659 2531 2660 default: 2532 2661 // Field doesn't exist on this type, so ignore it ··· 2549 2678 } 2550 2679 2551 2680 // t.Seq (int64) (int64) 2552 - if uint64(len("seq")) > cbg.MaxLength { 2681 + if len("seq") > 1000000 { 2553 2682 return xerrors.Errorf("Value in field \"seq\" was too long") 2554 2683 } 2555 2684 ··· 2571 2700 } 2572 2701 2573 2702 // t.Labels ([]*atproto.LabelDefs_Label) (slice) 2574 - if uint64(len("labels")) > cbg.MaxLength { 2703 + if len("labels") > 1000000 { 2575 2704 return xerrors.Errorf("Value in field \"labels\" was too long") 2576 2705 } 2577 2706 ··· 2582 2711 return err 2583 2712 } 2584 2713 2585 - if uint64(len(t.Labels)) > cbg.MaxLength { 2714 + if len(t.Labels) > 8192 { 2586 2715 return xerrors.Errorf("Slice value in field t.Labels was too long") 2587 2716 } 2588 2717 ··· 2627 2756 for i := uint64(0); i < n; i++ { 2628 2757 2629 2758 { 2630 - sval, err := cbg.ReadString(cr) 2759 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 2631 2760 if err != nil { 2632 2761 return err 2633 2762 } ··· 2640 2769 case "seq": 2641 2770 { 2642 2771 maj, extra, err := cr.ReadHeader() 2643 - var extraI int64 2644 2772 if err != nil { 2645 2773 return err 2646 2774 } 2775 + var extraI int64 2647 2776 switch maj { 2648 2777 case cbg.MajUnsignedInt: 2649 2778 extraI = int64(extra) ··· 2670 2799 return err 2671 2800 } 2672 2801 2673 - if extra > cbg.MaxLength { 2802 + if extra > 8192 { 2674 2803 return fmt.Errorf("t.Labels: array too large (%d)", extra) 2675 2804 } 2676 2805 ··· 2738 2867 } 2739 2868 2740 2869 // t.Name (string) (string) 2741 - if uint64(len("name")) > cbg.MaxLength { 2870 + if len("name") > 1000000 { 2742 2871 return xerrors.Errorf("Value in field \"name\" was too long") 2743 2872 } 2744 2873 ··· 2749 2878 return err 2750 2879 } 2751 2880 2752 - if uint64(len(t.Name)) > cbg.MaxLength { 2881 + if len(t.Name) > 1000000 { 2753 2882 return xerrors.Errorf("Value in field t.Name was too long") 2754 2883 } 2755 2884 ··· 2763 2892 // t.Message (string) (string) 2764 2893 if t.Message != nil { 2765 2894 2766 - if uint64(len("message")) > cbg.MaxLength { 2895 + if len("message") > 1000000 { 2767 2896 return xerrors.Errorf("Value in field \"message\" was too long") 2768 2897 } 2769 2898 ··· 2779 2908 return err 2780 2909 } 2781 2910 } else { 2782 - if uint64(len(*t.Message)) > cbg.MaxLength { 2911 + if len(*t.Message) > 1000000 { 2783 2912 return xerrors.Errorf("Value in field t.Message was too long") 2784 2913 } 2785 2914 ··· 2823 2952 for i := uint64(0); i < n; i++ { 2824 2953 2825 2954 { 2826 - sval, err := cbg.ReadString(cr) 2955 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 2827 2956 if err != nil { 2828 2957 return err 2829 2958 } ··· 2836 2965 case "name": 2837 2966 2838 2967 { 2839 - sval, err := cbg.ReadString(cr) 2968 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 2840 2969 if err != nil { 2841 2970 return err 2842 2971 } ··· 2856 2985 return err 2857 2986 } 2858 2987 2859 - sval, err := cbg.ReadString(cr) 2988 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 2860 2989 if err != nil { 2861 2990 return err 2862 2991 } ··· 2886 3015 } 2887 3016 2888 3017 // t.Blurs (string) (string) 2889 - if uint64(len("blurs")) > cbg.MaxLength { 3018 + if len("blurs") > 1000000 { 2890 3019 return xerrors.Errorf("Value in field \"blurs\" was too long") 2891 3020 } 2892 3021 ··· 2897 3026 return err 2898 3027 } 2899 3028 2900 - if uint64(len(t.Blurs)) > cbg.MaxLength { 3029 + if len(t.Blurs) > 1000000 { 2901 3030 return xerrors.Errorf("Value in field t.Blurs was too long") 2902 3031 } 2903 3032 ··· 2909 3038 } 2910 3039 2911 3040 // t.Locales ([]*atproto.LabelDefs_LabelValueDefinitionStrings) (slice) 2912 - if uint64(len("locales")) > cbg.MaxLength { 3041 + if len("locales") > 1000000 { 2913 3042 return xerrors.Errorf("Value in field \"locales\" was too long") 2914 3043 } 2915 3044 ··· 2920 3049 return err 2921 3050 } 2922 3051 2923 - if uint64(len(t.Locales)) > cbg.MaxLength { 3052 + if len(t.Locales) > 8192 { 2924 3053 return xerrors.Errorf("Slice value in field t.Locales was too long") 2925 3054 } 2926 3055 ··· 2935 3064 } 2936 3065 2937 3066 // t.Severity (string) (string) 2938 - if uint64(len("severity")) > cbg.MaxLength { 3067 + if len("severity") > 1000000 { 2939 3068 return xerrors.Errorf("Value in field \"severity\" was too long") 2940 3069 } 2941 3070 ··· 2946 3075 return err 2947 3076 } 2948 3077 2949 - if uint64(len(t.Severity)) > cbg.MaxLength { 3078 + if len(t.Severity) > 1000000 { 2950 3079 return xerrors.Errorf("Value in field t.Severity was too long") 2951 3080 } 2952 3081 ··· 2958 3087 } 2959 3088 2960 3089 // t.Identifier (string) (string) 2961 - if uint64(len("identifier")) > cbg.MaxLength { 3090 + if len("identifier") > 1000000 { 2962 3091 return xerrors.Errorf("Value in field \"identifier\" was too long") 2963 3092 } 2964 3093 ··· 2969 3098 return err 2970 3099 } 2971 3100 2972 - if uint64(len(t.Identifier)) > cbg.MaxLength { 3101 + if len(t.Identifier) > 1000000 { 2973 3102 return xerrors.Errorf("Value in field t.Identifier was too long") 2974 3103 } 2975 3104 ··· 3011 3140 for i := uint64(0); i < n; i++ { 3012 3141 3013 3142 { 3014 - sval, err := cbg.ReadString(cr) 3143 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 3015 3144 if err != nil { 3016 3145 return err 3017 3146 } ··· 3024 3153 case "blurs": 3025 3154 3026 3155 { 3027 - sval, err := cbg.ReadString(cr) 3156 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 3028 3157 if err != nil { 3029 3158 return err 3030 3159 } ··· 3039 3168 return err 3040 3169 } 3041 3170 3042 - if extra > cbg.MaxLength { 3171 + if extra > 8192 { 3043 3172 return fmt.Errorf("t.Locales: array too large (%d)", extra) 3044 3173 } 3045 3174 ··· 3084 3213 case "severity": 3085 3214 3086 3215 { 3087 - sval, err := cbg.ReadString(cr) 3216 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 3088 3217 if err != nil { 3089 3218 return err 3090 3219 } ··· 3095 3224 case "identifier": 3096 3225 3097 3226 { 3098 - sval, err := cbg.ReadString(cr) 3227 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 3099 3228 if err != nil { 3100 3229 return err 3101 3230 } ··· 3124 3253 } 3125 3254 3126 3255 // t.Lang (string) (string) 3127 - if uint64(len("lang")) > cbg.MaxLength { 3256 + if len("lang") > 1000000 { 3128 3257 return xerrors.Errorf("Value in field \"lang\" was too long") 3129 3258 } 3130 3259 ··· 3135 3264 return err 3136 3265 } 3137 3266 3138 - if uint64(len(t.Lang)) > cbg.MaxLength { 3267 + if len(t.Lang) > 1000000 { 3139 3268 return xerrors.Errorf("Value in field t.Lang was too long") 3140 3269 } 3141 3270 ··· 3147 3276 } 3148 3277 3149 3278 // t.Name (string) (string) 3150 - if uint64(len("name")) > cbg.MaxLength { 3279 + if len("name") > 1000000 { 3151 3280 return xerrors.Errorf("Value in field \"name\" was too long") 3152 3281 } 3153 3282 ··· 3158 3287 return err 3159 3288 } 3160 3289 3161 - if uint64(len(t.Name)) > cbg.MaxLength { 3290 + if len(t.Name) > 1000000 { 3162 3291 return xerrors.Errorf("Value in field t.Name was too long") 3163 3292 } 3164 3293 ··· 3170 3299 } 3171 3300 3172 3301 // t.Description (string) (string) 3173 - if uint64(len("description")) > cbg.MaxLength { 3302 + if len("description") > 1000000 { 3174 3303 return xerrors.Errorf("Value in field \"description\" was too long") 3175 3304 } 3176 3305 ··· 3181 3310 return err 3182 3311 } 3183 3312 3184 - if uint64(len(t.Description)) > cbg.MaxLength { 3313 + if len(t.Description) > 1000000 { 3185 3314 return xerrors.Errorf("Value in field t.Description was too long") 3186 3315 } 3187 3316 ··· 3223 3352 for i := uint64(0); i < n; i++ { 3224 3353 3225 3354 { 3226 - sval, err := cbg.ReadString(cr) 3355 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 3227 3356 if err != nil { 3228 3357 return err 3229 3358 } ··· 3236 3365 case "lang": 3237 3366 3238 3367 { 3239 - sval, err := cbg.ReadString(cr) 3368 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 3240 3369 if err != nil { 3241 3370 return err 3242 3371 } ··· 3247 3376 case "name": 3248 3377 3249 3378 { 3250 - sval, err := cbg.ReadString(cr) 3379 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 3251 3380 if err != nil { 3252 3381 return err 3253 3382 } ··· 3258 3387 case "description": 3259 3388 3260 3389 { 3261 - sval, err := cbg.ReadString(cr) 3390 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 3262 3391 if err != nil { 3263 3392 return err 3264 3393 }
+269 -266
api/bsky/cbor_gen.go
··· 64 64 // t.Tags ([]string) (slice) 65 65 if t.Tags != nil { 66 66 67 - if uint64(len("tags")) > cbg.MaxLength { 67 + if len("tags") > 1000000 { 68 68 return xerrors.Errorf("Value in field \"tags\" was too long") 69 69 } 70 70 ··· 75 75 return err 76 76 } 77 77 78 - if uint64(len(t.Tags)) > cbg.MaxLength { 78 + if len(t.Tags) > 8192 { 79 79 return xerrors.Errorf("Slice value in field t.Tags was too long") 80 80 } 81 81 ··· 83 83 return err 84 84 } 85 85 for _, v := range t.Tags { 86 - if uint64(len(v)) > cbg.MaxLength { 86 + if len(v) > 1000000 { 87 87 return xerrors.Errorf("Value in field v was too long") 88 88 } 89 89 ··· 98 98 } 99 99 100 100 // t.Text (string) (string) 101 - if uint64(len("text")) > cbg.MaxLength { 101 + if len("text") > 1000000 { 102 102 return xerrors.Errorf("Value in field \"text\" was too long") 103 103 } 104 104 ··· 109 109 return err 110 110 } 111 111 112 - if uint64(len(t.Text)) > cbg.MaxLength { 112 + if len(t.Text) > 1000000 { 113 113 return xerrors.Errorf("Value in field t.Text was too long") 114 114 } 115 115 ··· 121 121 } 122 122 123 123 // t.LexiconTypeID (string) (string) 124 - if uint64(len("$type")) > cbg.MaxLength { 124 + if len("$type") > 1000000 { 125 125 return xerrors.Errorf("Value in field \"$type\" was too long") 126 126 } 127 127 ··· 142 142 // t.Embed (bsky.FeedPost_Embed) (struct) 143 143 if t.Embed != nil { 144 144 145 - if uint64(len("embed")) > cbg.MaxLength { 145 + if len("embed") > 1000000 { 146 146 return xerrors.Errorf("Value in field \"embed\" was too long") 147 147 } 148 148 ··· 161 161 // t.Langs ([]string) (slice) 162 162 if t.Langs != nil { 163 163 164 - if uint64(len("langs")) > cbg.MaxLength { 164 + if len("langs") > 1000000 { 165 165 return xerrors.Errorf("Value in field \"langs\" was too long") 166 166 } 167 167 ··· 172 172 return err 173 173 } 174 174 175 - if uint64(len(t.Langs)) > cbg.MaxLength { 175 + if len(t.Langs) > 8192 { 176 176 return xerrors.Errorf("Slice value in field t.Langs was too long") 177 177 } 178 178 ··· 180 180 return err 181 181 } 182 182 for _, v := range t.Langs { 183 - if uint64(len(v)) > cbg.MaxLength { 183 + if len(v) > 1000000 { 184 184 return xerrors.Errorf("Value in field v was too long") 185 185 } 186 186 ··· 197 197 // t.Reply (bsky.FeedPost_ReplyRef) (struct) 198 198 if t.Reply != nil { 199 199 200 - if uint64(len("reply")) > cbg.MaxLength { 200 + if len("reply") > 1000000 { 201 201 return xerrors.Errorf("Value in field \"reply\" was too long") 202 202 } 203 203 ··· 216 216 // t.Facets ([]*bsky.RichtextFacet) (slice) 217 217 if t.Facets != nil { 218 218 219 - if uint64(len("facets")) > cbg.MaxLength { 219 + if len("facets") > 1000000 { 220 220 return xerrors.Errorf("Value in field \"facets\" was too long") 221 221 } 222 222 ··· 227 227 return err 228 228 } 229 229 230 - if uint64(len(t.Facets)) > cbg.MaxLength { 230 + if len(t.Facets) > 8192 { 231 231 return xerrors.Errorf("Slice value in field t.Facets was too long") 232 232 } 233 233 ··· 245 245 // t.Labels (bsky.FeedPost_Labels) (struct) 246 246 if t.Labels != nil { 247 247 248 - if uint64(len("labels")) > cbg.MaxLength { 248 + if len("labels") > 1000000 { 249 249 return xerrors.Errorf("Value in field \"labels\" was too long") 250 250 } 251 251 ··· 264 264 // t.Entities ([]*bsky.FeedPost_Entity) (slice) 265 265 if t.Entities != nil { 266 266 267 - if uint64(len("entities")) > cbg.MaxLength { 267 + if len("entities") > 1000000 { 268 268 return xerrors.Errorf("Value in field \"entities\" was too long") 269 269 } 270 270 ··· 275 275 return err 276 276 } 277 277 278 - if uint64(len(t.Entities)) > cbg.MaxLength { 278 + if len(t.Entities) > 8192 { 279 279 return xerrors.Errorf("Slice value in field t.Entities was too long") 280 280 } 281 281 ··· 291 291 } 292 292 293 293 // t.CreatedAt (string) (string) 294 - if uint64(len("createdAt")) > cbg.MaxLength { 294 + if len("createdAt") > 1000000 { 295 295 return xerrors.Errorf("Value in field \"createdAt\" was too long") 296 296 } 297 297 ··· 302 302 return err 303 303 } 304 304 305 - if uint64(len(t.CreatedAt)) > cbg.MaxLength { 305 + if len(t.CreatedAt) > 1000000 { 306 306 return xerrors.Errorf("Value in field t.CreatedAt was too long") 307 307 } 308 308 ··· 344 344 for i := uint64(0); i < n; i++ { 345 345 346 346 { 347 - sval, err := cbg.ReadString(cr) 347 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 348 348 if err != nil { 349 349 return err 350 350 } ··· 361 361 return err 362 362 } 363 363 364 - if extra > cbg.MaxLength { 364 + if extra > 8192 { 365 365 return fmt.Errorf("t.Tags: array too large (%d)", extra) 366 366 } 367 367 ··· 383 383 _ = err 384 384 385 385 { 386 - sval, err := cbg.ReadString(cr) 386 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 387 387 if err != nil { 388 388 return err 389 389 } ··· 397 397 case "text": 398 398 399 399 { 400 - sval, err := cbg.ReadString(cr) 400 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 401 401 if err != nil { 402 402 return err 403 403 } ··· 408 408 case "$type": 409 409 410 410 { 411 - sval, err := cbg.ReadString(cr) 411 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 412 412 if err != nil { 413 413 return err 414 414 } ··· 443 443 return err 444 444 } 445 445 446 - if extra > cbg.MaxLength { 446 + if extra > 8192 { 447 447 return fmt.Errorf("t.Langs: array too large (%d)", extra) 448 448 } 449 449 ··· 465 465 _ = err 466 466 467 467 { 468 - sval, err := cbg.ReadString(cr) 468 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 469 469 if err != nil { 470 470 return err 471 471 } ··· 503 503 return err 504 504 } 505 505 506 - if extra > cbg.MaxLength { 506 + if extra > 8192 { 507 507 return fmt.Errorf("t.Facets: array too large (%d)", extra) 508 508 } 509 509 ··· 572 572 return err 573 573 } 574 574 575 - if extra > cbg.MaxLength { 575 + if extra > 8192 { 576 576 return fmt.Errorf("t.Entities: array too large (%d)", extra) 577 577 } 578 578 ··· 617 617 case "createdAt": 618 618 619 619 { 620 - sval, err := cbg.ReadString(cr) 620 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 621 621 if err != nil { 622 622 return err 623 623 } ··· 646 646 } 647 647 648 648 // t.LexiconTypeID (string) (string) 649 - if uint64(len("$type")) > cbg.MaxLength { 649 + if len("$type") > 1000000 { 650 650 return xerrors.Errorf("Value in field \"$type\" was too long") 651 651 } 652 652 ··· 665 665 } 666 666 667 667 // t.Subject (atproto.RepoStrongRef) (struct) 668 - if uint64(len("subject")) > cbg.MaxLength { 668 + if len("subject") > 1000000 { 669 669 return xerrors.Errorf("Value in field \"subject\" was too long") 670 670 } 671 671 ··· 681 681 } 682 682 683 683 // t.CreatedAt (string) (string) 684 - if uint64(len("createdAt")) > cbg.MaxLength { 684 + if len("createdAt") > 1000000 { 685 685 return xerrors.Errorf("Value in field \"createdAt\" was too long") 686 686 } 687 687 ··· 692 692 return err 693 693 } 694 694 695 - if uint64(len(t.CreatedAt)) > cbg.MaxLength { 695 + if len(t.CreatedAt) > 1000000 { 696 696 return xerrors.Errorf("Value in field t.CreatedAt was too long") 697 697 } 698 698 ··· 734 734 for i := uint64(0); i < n; i++ { 735 735 736 736 { 737 - sval, err := cbg.ReadString(cr) 737 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 738 738 if err != nil { 739 739 return err 740 740 } ··· 747 747 case "$type": 748 748 749 749 { 750 - sval, err := cbg.ReadString(cr) 750 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 751 751 if err != nil { 752 752 return err 753 753 } ··· 778 778 case "createdAt": 779 779 780 780 { 781 - sval, err := cbg.ReadString(cr) 781 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 782 782 if err != nil { 783 783 return err 784 784 } ··· 807 807 } 808 808 809 809 // t.Type (string) (string) 810 - if uint64(len("type")) > cbg.MaxLength { 810 + if len("type") > 1000000 { 811 811 return xerrors.Errorf("Value in field \"type\" was too long") 812 812 } 813 813 ··· 818 818 return err 819 819 } 820 820 821 - if uint64(len(t.Type)) > cbg.MaxLength { 821 + if len(t.Type) > 1000000 { 822 822 return xerrors.Errorf("Value in field t.Type was too long") 823 823 } 824 824 ··· 830 830 } 831 831 832 832 // t.Index (bsky.FeedPost_TextSlice) (struct) 833 - if uint64(len("index")) > cbg.MaxLength { 833 + if len("index") > 1000000 { 834 834 return xerrors.Errorf("Value in field \"index\" was too long") 835 835 } 836 836 ··· 846 846 } 847 847 848 848 // t.Value (string) (string) 849 - if uint64(len("value")) > cbg.MaxLength { 849 + if len("value") > 1000000 { 850 850 return xerrors.Errorf("Value in field \"value\" was too long") 851 851 } 852 852 ··· 857 857 return err 858 858 } 859 859 860 - if uint64(len(t.Value)) > cbg.MaxLength { 860 + if len(t.Value) > 1000000 { 861 861 return xerrors.Errorf("Value in field t.Value was too long") 862 862 } 863 863 ··· 899 899 for i := uint64(0); i < n; i++ { 900 900 901 901 { 902 - sval, err := cbg.ReadString(cr) 902 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 903 903 if err != nil { 904 904 return err 905 905 } ··· 912 912 case "type": 913 913 914 914 { 915 - sval, err := cbg.ReadString(cr) 915 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 916 916 if err != nil { 917 917 return err 918 918 } ··· 943 943 case "value": 944 944 945 945 { 946 - sval, err := cbg.ReadString(cr) 946 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 947 947 if err != nil { 948 948 return err 949 949 } ··· 972 972 } 973 973 974 974 // t.Root (atproto.RepoStrongRef) (struct) 975 - if uint64(len("root")) > cbg.MaxLength { 975 + if len("root") > 1000000 { 976 976 return xerrors.Errorf("Value in field \"root\" was too long") 977 977 } 978 978 ··· 988 988 } 989 989 990 990 // t.Parent (atproto.RepoStrongRef) (struct) 991 - if uint64(len("parent")) > cbg.MaxLength { 991 + if len("parent") > 1000000 { 992 992 return xerrors.Errorf("Value in field \"parent\" was too long") 993 993 } 994 994 ··· 1034 1034 for i := uint64(0); i < n; i++ { 1035 1035 1036 1036 { 1037 - sval, err := cbg.ReadString(cr) 1037 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 1038 1038 if err != nil { 1039 1039 return err 1040 1040 } ··· 1105 1105 } 1106 1106 1107 1107 // t.End (int64) (int64) 1108 - if uint64(len("end")) > cbg.MaxLength { 1108 + if len("end") > 1000000 { 1109 1109 return xerrors.Errorf("Value in field \"end\" was too long") 1110 1110 } 1111 1111 ··· 1127 1127 } 1128 1128 1129 1129 // t.Start (int64) (int64) 1130 - if uint64(len("start")) > cbg.MaxLength { 1130 + if len("start") > 1000000 { 1131 1131 return xerrors.Errorf("Value in field \"start\" was too long") 1132 1132 } 1133 1133 ··· 1147 1147 return err 1148 1148 } 1149 1149 } 1150 + 1150 1151 return nil 1151 1152 } 1152 1153 ··· 1179 1180 for i := uint64(0); i < n; i++ { 1180 1181 1181 1182 { 1182 - sval, err := cbg.ReadString(cr) 1183 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 1183 1184 if err != nil { 1184 1185 return err 1185 1186 } ··· 1192 1193 case "end": 1193 1194 { 1194 1195 maj, extra, err := cr.ReadHeader() 1195 - var extraI int64 1196 1196 if err != nil { 1197 1197 return err 1198 1198 } 1199 + var extraI int64 1199 1200 switch maj { 1200 1201 case cbg.MajUnsignedInt: 1201 1202 extraI = int64(extra) ··· 1218 1219 case "start": 1219 1220 { 1220 1221 maj, extra, err := cr.ReadHeader() 1221 - var extraI int64 1222 1222 if err != nil { 1223 1223 return err 1224 1224 } 1225 + var extraI int64 1225 1226 switch maj { 1226 1227 case cbg.MajUnsignedInt: 1227 1228 extraI = int64(extra) ··· 1262 1263 } 1263 1264 1264 1265 // t.LexiconTypeID (string) (string) 1265 - if uint64(len("$type")) > cbg.MaxLength { 1266 + if len("$type") > 1000000 { 1266 1267 return xerrors.Errorf("Value in field \"$type\" was too long") 1267 1268 } 1268 1269 ··· 1281 1282 } 1282 1283 1283 1284 // t.Images ([]*bsky.EmbedImages_Image) (slice) 1284 - if uint64(len("images")) > cbg.MaxLength { 1285 + if len("images") > 1000000 { 1285 1286 return xerrors.Errorf("Value in field \"images\" was too long") 1286 1287 } 1287 1288 ··· 1292 1293 return err 1293 1294 } 1294 1295 1295 - if uint64(len(t.Images)) > cbg.MaxLength { 1296 + if len(t.Images) > 8192 { 1296 1297 return xerrors.Errorf("Slice value in field t.Images was too long") 1297 1298 } 1298 1299 ··· 1337 1338 for i := uint64(0); i < n; i++ { 1338 1339 1339 1340 { 1340 - sval, err := cbg.ReadString(cr) 1341 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 1341 1342 if err != nil { 1342 1343 return err 1343 1344 } ··· 1350 1351 case "$type": 1351 1352 1352 1353 { 1353 - sval, err := cbg.ReadString(cr) 1354 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 1354 1355 if err != nil { 1355 1356 return err 1356 1357 } ··· 1365 1366 return err 1366 1367 } 1367 1368 1368 - if extra > cbg.MaxLength { 1369 + if extra > 8192 { 1369 1370 return fmt.Errorf("t.Images: array too large (%d)", extra) 1370 1371 } 1371 1372 ··· 1428 1429 } 1429 1430 1430 1431 // t.LexiconTypeID (string) (string) 1431 - if uint64(len("$type")) > cbg.MaxLength { 1432 + if len("$type") > 1000000 { 1432 1433 return xerrors.Errorf("Value in field \"$type\" was too long") 1433 1434 } 1434 1435 ··· 1447 1448 } 1448 1449 1449 1450 // t.External (bsky.EmbedExternal_External) (struct) 1450 - if uint64(len("external")) > cbg.MaxLength { 1451 + if len("external") > 1000000 { 1451 1452 return xerrors.Errorf("Value in field \"external\" was too long") 1452 1453 } 1453 1454 ··· 1493 1494 for i := uint64(0); i < n; i++ { 1494 1495 1495 1496 { 1496 - sval, err := cbg.ReadString(cr) 1497 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 1497 1498 if err != nil { 1498 1499 return err 1499 1500 } ··· 1506 1507 case "$type": 1507 1508 1508 1509 { 1509 - sval, err := cbg.ReadString(cr) 1510 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 1510 1511 if err != nil { 1511 1512 return err 1512 1513 } ··· 1560 1561 } 1561 1562 1562 1563 // t.Uri (string) (string) 1563 - if uint64(len("uri")) > cbg.MaxLength { 1564 + if len("uri") > 1000000 { 1564 1565 return xerrors.Errorf("Value in field \"uri\" was too long") 1565 1566 } 1566 1567 ··· 1571 1572 return err 1572 1573 } 1573 1574 1574 - if uint64(len(t.Uri)) > cbg.MaxLength { 1575 + if len(t.Uri) > 1000000 { 1575 1576 return xerrors.Errorf("Value in field t.Uri was too long") 1576 1577 } 1577 1578 ··· 1585 1586 // t.Thumb (util.LexBlob) (struct) 1586 1587 if t.Thumb != nil { 1587 1588 1588 - if uint64(len("thumb")) > cbg.MaxLength { 1589 + if len("thumb") > 1000000 { 1589 1590 return xerrors.Errorf("Value in field \"thumb\" was too long") 1590 1591 } 1591 1592 ··· 1602 1603 } 1603 1604 1604 1605 // t.Title (string) (string) 1605 - if uint64(len("title")) > cbg.MaxLength { 1606 + if len("title") > 1000000 { 1606 1607 return xerrors.Errorf("Value in field \"title\" was too long") 1607 1608 } 1608 1609 ··· 1613 1614 return err 1614 1615 } 1615 1616 1616 - if uint64(len(t.Title)) > cbg.MaxLength { 1617 + if len(t.Title) > 1000000 { 1617 1618 return xerrors.Errorf("Value in field t.Title was too long") 1618 1619 } 1619 1620 ··· 1625 1626 } 1626 1627 1627 1628 // t.Description (string) (string) 1628 - if uint64(len("description")) > cbg.MaxLength { 1629 + if len("description") > 1000000 { 1629 1630 return xerrors.Errorf("Value in field \"description\" was too long") 1630 1631 } 1631 1632 ··· 1636 1637 return err 1637 1638 } 1638 1639 1639 - if uint64(len(t.Description)) > cbg.MaxLength { 1640 + if len(t.Description) > 1000000 { 1640 1641 return xerrors.Errorf("Value in field t.Description was too long") 1641 1642 } 1642 1643 ··· 1678 1679 for i := uint64(0); i < n; i++ { 1679 1680 1680 1681 { 1681 - sval, err := cbg.ReadString(cr) 1682 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 1682 1683 if err != nil { 1683 1684 return err 1684 1685 } ··· 1691 1692 case "uri": 1692 1693 1693 1694 { 1694 - sval, err := cbg.ReadString(cr) 1695 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 1695 1696 if err != nil { 1696 1697 return err 1697 1698 } ··· 1722 1723 case "title": 1723 1724 1724 1725 { 1725 - sval, err := cbg.ReadString(cr) 1726 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 1726 1727 if err != nil { 1727 1728 return err 1728 1729 } ··· 1733 1734 case "description": 1734 1735 1735 1736 { 1736 - sval, err := cbg.ReadString(cr) 1737 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 1737 1738 if err != nil { 1738 1739 return err 1739 1740 } ··· 1767 1768 } 1768 1769 1769 1770 // t.Alt (string) (string) 1770 - if uint64(len("alt")) > cbg.MaxLength { 1771 + if len("alt") > 1000000 { 1771 1772 return xerrors.Errorf("Value in field \"alt\" was too long") 1772 1773 } 1773 1774 ··· 1778 1779 return err 1779 1780 } 1780 1781 1781 - if uint64(len(t.Alt)) > cbg.MaxLength { 1782 + if len(t.Alt) > 1000000 { 1782 1783 return xerrors.Errorf("Value in field t.Alt was too long") 1783 1784 } 1784 1785 ··· 1790 1791 } 1791 1792 1792 1793 // t.Image (util.LexBlob) (struct) 1793 - if uint64(len("image")) > cbg.MaxLength { 1794 + if len("image") > 1000000 { 1794 1795 return xerrors.Errorf("Value in field \"image\" was too long") 1795 1796 } 1796 1797 ··· 1808 1809 // t.AspectRatio (bsky.EmbedImages_AspectRatio) (struct) 1809 1810 if t.AspectRatio != nil { 1810 1811 1811 - if uint64(len("aspectRatio")) > cbg.MaxLength { 1812 + if len("aspectRatio") > 1000000 { 1812 1813 return xerrors.Errorf("Value in field \"aspectRatio\" was too long") 1813 1814 } 1814 1815 ··· 1855 1856 for i := uint64(0); i < n; i++ { 1856 1857 1857 1858 { 1858 - sval, err := cbg.ReadString(cr) 1859 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 1859 1860 if err != nil { 1860 1861 return err 1861 1862 } ··· 1868 1869 case "alt": 1869 1870 1870 1871 { 1871 - sval, err := cbg.ReadString(cr) 1872 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 1872 1873 if err != nil { 1873 1874 return err 1874 1875 } ··· 1937 1938 } 1938 1939 1939 1940 // t.LexiconTypeID (string) (string) 1940 - if uint64(len("$type")) > cbg.MaxLength { 1941 + if len("$type") > 1000000 { 1941 1942 return xerrors.Errorf("Value in field \"$type\" was too long") 1942 1943 } 1943 1944 ··· 1956 1957 } 1957 1958 1958 1959 // t.Subject (string) (string) 1959 - if uint64(len("subject")) > cbg.MaxLength { 1960 + if len("subject") > 1000000 { 1960 1961 return xerrors.Errorf("Value in field \"subject\" was too long") 1961 1962 } 1962 1963 ··· 1967 1968 return err 1968 1969 } 1969 1970 1970 - if uint64(len(t.Subject)) > cbg.MaxLength { 1971 + if len(t.Subject) > 1000000 { 1971 1972 return xerrors.Errorf("Value in field t.Subject was too long") 1972 1973 } 1973 1974 ··· 1979 1980 } 1980 1981 1981 1982 // t.CreatedAt (string) (string) 1982 - if uint64(len("createdAt")) > cbg.MaxLength { 1983 + if len("createdAt") > 1000000 { 1983 1984 return xerrors.Errorf("Value in field \"createdAt\" was too long") 1984 1985 } 1985 1986 ··· 1990 1991 return err 1991 1992 } 1992 1993 1993 - if uint64(len(t.CreatedAt)) > cbg.MaxLength { 1994 + if len(t.CreatedAt) > 1000000 { 1994 1995 return xerrors.Errorf("Value in field t.CreatedAt was too long") 1995 1996 } 1996 1997 ··· 2032 2033 for i := uint64(0); i < n; i++ { 2033 2034 2034 2035 { 2035 - sval, err := cbg.ReadString(cr) 2036 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 2036 2037 if err != nil { 2037 2038 return err 2038 2039 } ··· 2045 2046 case "$type": 2046 2047 2047 2048 { 2048 - sval, err := cbg.ReadString(cr) 2049 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 2049 2050 if err != nil { 2050 2051 return err 2051 2052 } ··· 2056 2057 case "subject": 2057 2058 2058 2059 { 2059 - sval, err := cbg.ReadString(cr) 2060 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 2060 2061 if err != nil { 2061 2062 return err 2062 2063 } ··· 2067 2068 case "createdAt": 2068 2069 2069 2070 { 2070 - sval, err := cbg.ReadString(cr) 2071 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 2071 2072 if err != nil { 2072 2073 return err 2073 2074 } ··· 2117 2118 } 2118 2119 2119 2120 // t.LexiconTypeID (string) (string) 2120 - if uint64(len("$type")) > cbg.MaxLength { 2121 + if len("$type") > 1000000 { 2121 2122 return xerrors.Errorf("Value in field \"$type\" was too long") 2122 2123 } 2123 2124 ··· 2138 2139 // t.Avatar (util.LexBlob) (struct) 2139 2140 if t.Avatar != nil { 2140 2141 2141 - if uint64(len("avatar")) > cbg.MaxLength { 2142 + if len("avatar") > 1000000 { 2142 2143 return xerrors.Errorf("Value in field \"avatar\" was too long") 2143 2144 } 2144 2145 ··· 2157 2158 // t.Banner (util.LexBlob) (struct) 2158 2159 if t.Banner != nil { 2159 2160 2160 - if uint64(len("banner")) > cbg.MaxLength { 2161 + if len("banner") > 1000000 { 2161 2162 return xerrors.Errorf("Value in field \"banner\" was too long") 2162 2163 } 2163 2164 ··· 2176 2177 // t.Labels (bsky.ActorProfile_Labels) (struct) 2177 2178 if t.Labels != nil { 2178 2179 2179 - if uint64(len("labels")) > cbg.MaxLength { 2180 + if len("labels") > 1000000 { 2180 2181 return xerrors.Errorf("Value in field \"labels\" was too long") 2181 2182 } 2182 2183 ··· 2195 2196 // t.Description (string) (string) 2196 2197 if t.Description != nil { 2197 2198 2198 - if uint64(len("description")) > cbg.MaxLength { 2199 + if len("description") > 1000000 { 2199 2200 return xerrors.Errorf("Value in field \"description\" was too long") 2200 2201 } 2201 2202 ··· 2211 2212 return err 2212 2213 } 2213 2214 } else { 2214 - if uint64(len(*t.Description)) > cbg.MaxLength { 2215 + if len(*t.Description) > 1000000 { 2215 2216 return xerrors.Errorf("Value in field t.Description was too long") 2216 2217 } 2217 2218 ··· 2227 2228 // t.DisplayName (string) (string) 2228 2229 if t.DisplayName != nil { 2229 2230 2230 - if uint64(len("displayName")) > cbg.MaxLength { 2231 + if len("displayName") > 1000000 { 2231 2232 return xerrors.Errorf("Value in field \"displayName\" was too long") 2232 2233 } 2233 2234 ··· 2243 2244 return err 2244 2245 } 2245 2246 } else { 2246 - if uint64(len(*t.DisplayName)) > cbg.MaxLength { 2247 + if len(*t.DisplayName) > 1000000 { 2247 2248 return xerrors.Errorf("Value in field t.DisplayName was too long") 2248 2249 } 2249 2250 ··· 2287 2288 for i := uint64(0); i < n; i++ { 2288 2289 2289 2290 { 2290 - sval, err := cbg.ReadString(cr) 2291 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 2291 2292 if err != nil { 2292 2293 return err 2293 2294 } ··· 2300 2301 case "$type": 2301 2302 2302 2303 { 2303 - sval, err := cbg.ReadString(cr) 2304 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 2304 2305 if err != nil { 2305 2306 return err 2306 2307 } ··· 2380 2381 return err 2381 2382 } 2382 2383 2383 - sval, err := cbg.ReadString(cr) 2384 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 2384 2385 if err != nil { 2385 2386 return err 2386 2387 } ··· 2401 2402 return err 2402 2403 } 2403 2404 2404 - sval, err := cbg.ReadString(cr) 2405 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 2405 2406 if err != nil { 2406 2407 return err 2407 2408 } ··· 2431 2432 } 2432 2433 2433 2434 // t.LexiconTypeID (string) (string) 2434 - if uint64(len("$type")) > cbg.MaxLength { 2435 + if len("$type") > 1000000 { 2435 2436 return xerrors.Errorf("Value in field \"$type\" was too long") 2436 2437 } 2437 2438 ··· 2450 2451 } 2451 2452 2452 2453 // t.Record (atproto.RepoStrongRef) (struct) 2453 - if uint64(len("record")) > cbg.MaxLength { 2454 + if len("record") > 1000000 { 2454 2455 return xerrors.Errorf("Value in field \"record\" was too long") 2455 2456 } 2456 2457 ··· 2496 2497 for i := uint64(0); i < n; i++ { 2497 2498 2498 2499 { 2499 - sval, err := cbg.ReadString(cr) 2500 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 2500 2501 if err != nil { 2501 2502 return err 2502 2503 } ··· 2509 2510 case "$type": 2510 2511 2511 2512 { 2512 - sval, err := cbg.ReadString(cr) 2513 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 2513 2514 if err != nil { 2514 2515 return err 2515 2516 } ··· 2558 2559 } 2559 2560 2560 2561 // t.LexiconTypeID (string) (string) 2561 - if uint64(len("$type")) > cbg.MaxLength { 2562 + if len("$type") > 1000000 { 2562 2563 return xerrors.Errorf("Value in field \"$type\" was too long") 2563 2564 } 2564 2565 ··· 2577 2578 } 2578 2579 2579 2580 // t.Subject (atproto.RepoStrongRef) (struct) 2580 - if uint64(len("subject")) > cbg.MaxLength { 2581 + if len("subject") > 1000000 { 2581 2582 return xerrors.Errorf("Value in field \"subject\" was too long") 2582 2583 } 2583 2584 ··· 2593 2594 } 2594 2595 2595 2596 // t.CreatedAt (string) (string) 2596 - if uint64(len("createdAt")) > cbg.MaxLength { 2597 + if len("createdAt") > 1000000 { 2597 2598 return xerrors.Errorf("Value in field \"createdAt\" was too long") 2598 2599 } 2599 2600 ··· 2604 2605 return err 2605 2606 } 2606 2607 2607 - if uint64(len(t.CreatedAt)) > cbg.MaxLength { 2608 + if len(t.CreatedAt) > 1000000 { 2608 2609 return xerrors.Errorf("Value in field t.CreatedAt was too long") 2609 2610 } 2610 2611 ··· 2646 2647 for i := uint64(0); i < n; i++ { 2647 2648 2648 2649 { 2649 - sval, err := cbg.ReadString(cr) 2650 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 2650 2651 if err != nil { 2651 2652 return err 2652 2653 } ··· 2659 2660 case "$type": 2660 2661 2661 2662 { 2662 - sval, err := cbg.ReadString(cr) 2663 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 2663 2664 if err != nil { 2664 2665 return err 2665 2666 } ··· 2690 2691 case "createdAt": 2691 2692 2692 2693 { 2693 - sval, err := cbg.ReadString(cr) 2694 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 2694 2695 if err != nil { 2695 2696 return err 2696 2697 } ··· 2719 2720 } 2720 2721 2721 2722 // t.Index (bsky.RichtextFacet_ByteSlice) (struct) 2722 - if uint64(len("index")) > cbg.MaxLength { 2723 + if len("index") > 1000000 { 2723 2724 return xerrors.Errorf("Value in field \"index\" was too long") 2724 2725 } 2725 2726 ··· 2735 2736 } 2736 2737 2737 2738 // t.Features ([]*bsky.RichtextFacet_Features_Elem) (slice) 2738 - if uint64(len("features")) > cbg.MaxLength { 2739 + if len("features") > 1000000 { 2739 2740 return xerrors.Errorf("Value in field \"features\" was too long") 2740 2741 } 2741 2742 ··· 2746 2747 return err 2747 2748 } 2748 2749 2749 - if uint64(len(t.Features)) > cbg.MaxLength { 2750 + if len(t.Features) > 8192 { 2750 2751 return xerrors.Errorf("Slice value in field t.Features was too long") 2751 2752 } 2752 2753 ··· 2791 2792 for i := uint64(0); i < n; i++ { 2792 2793 2793 2794 { 2794 - sval, err := cbg.ReadString(cr) 2795 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 2795 2796 if err != nil { 2796 2797 return err 2797 2798 } ··· 2828 2829 return err 2829 2830 } 2830 2831 2831 - if extra > cbg.MaxLength { 2832 + if extra > 8192 { 2832 2833 return fmt.Errorf("t.Features: array too large (%d)", extra) 2833 2834 } 2834 2835 ··· 2891 2892 } 2892 2893 2893 2894 // t.ByteEnd (int64) (int64) 2894 - if uint64(len("byteEnd")) > cbg.MaxLength { 2895 + if len("byteEnd") > 1000000 { 2895 2896 return xerrors.Errorf("Value in field \"byteEnd\" was too long") 2896 2897 } 2897 2898 ··· 2913 2914 } 2914 2915 2915 2916 // t.ByteStart (int64) (int64) 2916 - if uint64(len("byteStart")) > cbg.MaxLength { 2917 + if len("byteStart") > 1000000 { 2917 2918 return xerrors.Errorf("Value in field \"byteStart\" was too long") 2918 2919 } 2919 2920 ··· 2933 2934 return err 2934 2935 } 2935 2936 } 2937 + 2936 2938 return nil 2937 2939 } 2938 2940 ··· 2965 2967 for i := uint64(0); i < n; i++ { 2966 2968 2967 2969 { 2968 - sval, err := cbg.ReadString(cr) 2970 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 2969 2971 if err != nil { 2970 2972 return err 2971 2973 } ··· 2978 2980 case "byteEnd": 2979 2981 { 2980 2982 maj, extra, err := cr.ReadHeader() 2981 - var extraI int64 2982 2983 if err != nil { 2983 2984 return err 2984 2985 } 2986 + var extraI int64 2985 2987 switch maj { 2986 2988 case cbg.MajUnsignedInt: 2987 2989 extraI = int64(extra) ··· 3004 3006 case "byteStart": 3005 3007 { 3006 3008 maj, extra, err := cr.ReadHeader() 3007 - var extraI int64 3008 3009 if err != nil { 3009 3010 return err 3010 3011 } 3012 + var extraI int64 3011 3013 switch maj { 3012 3014 case cbg.MajUnsignedInt: 3013 3015 extraI = int64(extra) ··· 3048 3050 } 3049 3051 3050 3052 // t.Uri (string) (string) 3051 - if uint64(len("uri")) > cbg.MaxLength { 3053 + if len("uri") > 1000000 { 3052 3054 return xerrors.Errorf("Value in field \"uri\" was too long") 3053 3055 } 3054 3056 ··· 3059 3061 return err 3060 3062 } 3061 3063 3062 - if uint64(len(t.Uri)) > cbg.MaxLength { 3064 + if len(t.Uri) > 1000000 { 3063 3065 return xerrors.Errorf("Value in field t.Uri was too long") 3064 3066 } 3065 3067 ··· 3071 3073 } 3072 3074 3073 3075 // t.LexiconTypeID (string) (string) 3074 - if uint64(len("$type")) > cbg.MaxLength { 3076 + if len("$type") > 1000000 { 3075 3077 return xerrors.Errorf("Value in field \"$type\" was too long") 3076 3078 } 3077 3079 ··· 3120 3122 for i := uint64(0); i < n; i++ { 3121 3123 3122 3124 { 3123 - sval, err := cbg.ReadString(cr) 3125 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 3124 3126 if err != nil { 3125 3127 return err 3126 3128 } ··· 3133 3135 case "uri": 3134 3136 3135 3137 { 3136 - sval, err := cbg.ReadString(cr) 3138 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 3137 3139 if err != nil { 3138 3140 return err 3139 3141 } ··· 3144 3146 case "$type": 3145 3147 3146 3148 { 3147 - sval, err := cbg.ReadString(cr) 3149 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 3148 3150 if err != nil { 3149 3151 return err 3150 3152 } ··· 3173 3175 } 3174 3176 3175 3177 // t.Did (string) (string) 3176 - if uint64(len("did")) > cbg.MaxLength { 3178 + if len("did") > 1000000 { 3177 3179 return xerrors.Errorf("Value in field \"did\" was too long") 3178 3180 } 3179 3181 ··· 3184 3186 return err 3185 3187 } 3186 3188 3187 - if uint64(len(t.Did)) > cbg.MaxLength { 3189 + if len(t.Did) > 1000000 { 3188 3190 return xerrors.Errorf("Value in field t.Did was too long") 3189 3191 } 3190 3192 ··· 3196 3198 } 3197 3199 3198 3200 // t.LexiconTypeID (string) (string) 3199 - if uint64(len("$type")) > cbg.MaxLength { 3201 + if len("$type") > 1000000 { 3200 3202 return xerrors.Errorf("Value in field \"$type\" was too long") 3201 3203 } 3202 3204 ··· 3245 3247 for i := uint64(0); i < n; i++ { 3246 3248 3247 3249 { 3248 - sval, err := cbg.ReadString(cr) 3250 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 3249 3251 if err != nil { 3250 3252 return err 3251 3253 } ··· 3258 3260 case "did": 3259 3261 3260 3262 { 3261 - sval, err := cbg.ReadString(cr) 3263 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 3262 3264 if err != nil { 3263 3265 return err 3264 3266 } ··· 3269 3271 case "$type": 3270 3272 3271 3273 { 3272 - sval, err := cbg.ReadString(cr) 3274 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 3273 3275 if err != nil { 3274 3276 return err 3275 3277 } ··· 3298 3300 } 3299 3301 3300 3302 // t.Tag (string) (string) 3301 - if uint64(len("tag")) > cbg.MaxLength { 3303 + if len("tag") > 1000000 { 3302 3304 return xerrors.Errorf("Value in field \"tag\" was too long") 3303 3305 } 3304 3306 ··· 3309 3311 return err 3310 3312 } 3311 3313 3312 - if uint64(len(t.Tag)) > cbg.MaxLength { 3314 + if len(t.Tag) > 1000000 { 3313 3315 return xerrors.Errorf("Value in field t.Tag was too long") 3314 3316 } 3315 3317 ··· 3321 3323 } 3322 3324 3323 3325 // t.LexiconTypeID (string) (string) 3324 - if uint64(len("$type")) > cbg.MaxLength { 3326 + if len("$type") > 1000000 { 3325 3327 return xerrors.Errorf("Value in field \"$type\" was too long") 3326 3328 } 3327 3329 ··· 3370 3372 for i := uint64(0); i < n; i++ { 3371 3373 3372 3374 { 3373 - sval, err := cbg.ReadString(cr) 3375 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 3374 3376 if err != nil { 3375 3377 return err 3376 3378 } ··· 3383 3385 case "tag": 3384 3386 3385 3387 { 3386 - sval, err := cbg.ReadString(cr) 3388 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 3387 3389 if err != nil { 3388 3390 return err 3389 3391 } ··· 3394 3396 case "$type": 3395 3397 3396 3398 { 3397 - sval, err := cbg.ReadString(cr) 3399 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 3398 3400 if err != nil { 3399 3401 return err 3400 3402 } ··· 3423 3425 } 3424 3426 3425 3427 // t.LexiconTypeID (string) (string) 3426 - if uint64(len("$type")) > cbg.MaxLength { 3428 + if len("$type") > 1000000 { 3427 3429 return xerrors.Errorf("Value in field \"$type\" was too long") 3428 3430 } 3429 3431 ··· 3442 3444 } 3443 3445 3444 3446 // t.Media (bsky.EmbedRecordWithMedia_Media) (struct) 3445 - if uint64(len("media")) > cbg.MaxLength { 3447 + if len("media") > 1000000 { 3446 3448 return xerrors.Errorf("Value in field \"media\" was too long") 3447 3449 } 3448 3450 ··· 3458 3460 } 3459 3461 3460 3462 // t.Record (bsky.EmbedRecord) (struct) 3461 - if uint64(len("record")) > cbg.MaxLength { 3463 + if len("record") > 1000000 { 3462 3464 return xerrors.Errorf("Value in field \"record\" was too long") 3463 3465 } 3464 3466 ··· 3504 3506 for i := uint64(0); i < n; i++ { 3505 3507 3506 3508 { 3507 - sval, err := cbg.ReadString(cr) 3509 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 3508 3510 if err != nil { 3509 3511 return err 3510 3512 } ··· 3517 3519 case "$type": 3518 3520 3519 3521 { 3520 - sval, err := cbg.ReadString(cr) 3522 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 3521 3523 if err != nil { 3522 3524 return err 3523 3525 } ··· 3586 3588 } 3587 3589 3588 3590 // t.Uri (string) (string) 3589 - if uint64(len("uri")) > cbg.MaxLength { 3591 + if len("uri") > 1000000 { 3590 3592 return xerrors.Errorf("Value in field \"uri\" was too long") 3591 3593 } 3592 3594 ··· 3597 3599 return err 3598 3600 } 3599 3601 3600 - if uint64(len(t.Uri)) > cbg.MaxLength { 3602 + if len(t.Uri) > 1000000 { 3601 3603 return xerrors.Errorf("Value in field t.Uri was too long") 3602 3604 } 3603 3605 ··· 3609 3611 } 3610 3612 3611 3613 // t.LexiconTypeID (string) (string) 3612 - if uint64(len("$type")) > cbg.MaxLength { 3614 + if len("$type") > 1000000 { 3613 3615 return xerrors.Errorf("Value in field \"$type\" was too long") 3614 3616 } 3615 3617 ··· 3628 3630 } 3629 3631 3630 3632 // t.NotFound (bool) (bool) 3631 - if uint64(len("notFound")) > cbg.MaxLength { 3633 + if len("notFound") > 1000000 { 3632 3634 return xerrors.Errorf("Value in field \"notFound\" was too long") 3633 3635 } 3634 3636 ··· 3674 3676 for i := uint64(0); i < n; i++ { 3675 3677 3676 3678 { 3677 - sval, err := cbg.ReadString(cr) 3679 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 3678 3680 if err != nil { 3679 3681 return err 3680 3682 } ··· 3687 3689 case "uri": 3688 3690 3689 3691 { 3690 - sval, err := cbg.ReadString(cr) 3692 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 3691 3693 if err != nil { 3692 3694 return err 3693 3695 } ··· 3698 3700 case "$type": 3699 3701 3700 3702 { 3701 - sval, err := cbg.ReadString(cr) 3703 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 3702 3704 if err != nil { 3703 3705 return err 3704 3706 } ··· 3745 3747 } 3746 3748 3747 3749 // t.LexiconTypeID (string) (string) 3748 - if uint64(len("$type")) > cbg.MaxLength { 3750 + if len("$type") > 1000000 { 3749 3751 return xerrors.Errorf("Value in field \"$type\" was too long") 3750 3752 } 3751 3753 ··· 3764 3766 } 3765 3767 3766 3768 // t.Subject (string) (string) 3767 - if uint64(len("subject")) > cbg.MaxLength { 3769 + if len("subject") > 1000000 { 3768 3770 return xerrors.Errorf("Value in field \"subject\" was too long") 3769 3771 } 3770 3772 ··· 3775 3777 return err 3776 3778 } 3777 3779 3778 - if uint64(len(t.Subject)) > cbg.MaxLength { 3780 + if len(t.Subject) > 1000000 { 3779 3781 return xerrors.Errorf("Value in field t.Subject was too long") 3780 3782 } 3781 3783 ··· 3787 3789 } 3788 3790 3789 3791 // t.CreatedAt (string) (string) 3790 - if uint64(len("createdAt")) > cbg.MaxLength { 3792 + if len("createdAt") > 1000000 { 3791 3793 return xerrors.Errorf("Value in field \"createdAt\" was too long") 3792 3794 } 3793 3795 ··· 3798 3800 return err 3799 3801 } 3800 3802 3801 - if uint64(len(t.CreatedAt)) > cbg.MaxLength { 3803 + if len(t.CreatedAt) > 1000000 { 3802 3804 return xerrors.Errorf("Value in field t.CreatedAt was too long") 3803 3805 } 3804 3806 ··· 3840 3842 for i := uint64(0); i < n; i++ { 3841 3843 3842 3844 { 3843 - sval, err := cbg.ReadString(cr) 3845 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 3844 3846 if err != nil { 3845 3847 return err 3846 3848 } ··· 3853 3855 case "$type": 3854 3856 3855 3857 { 3856 - sval, err := cbg.ReadString(cr) 3858 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 3857 3859 if err != nil { 3858 3860 return err 3859 3861 } ··· 3864 3866 case "subject": 3865 3867 3866 3868 { 3867 - sval, err := cbg.ReadString(cr) 3869 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 3868 3870 if err != nil { 3869 3871 return err 3870 3872 } ··· 3875 3877 case "createdAt": 3876 3878 3877 3879 { 3878 - sval, err := cbg.ReadString(cr) 3880 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 3879 3881 if err != nil { 3880 3882 return err 3881 3883 } ··· 3921 3923 } 3922 3924 3923 3925 // t.Name (string) (string) 3924 - if uint64(len("name")) > cbg.MaxLength { 3926 + if len("name") > 1000000 { 3925 3927 return xerrors.Errorf("Value in field \"name\" was too long") 3926 3928 } 3927 3929 ··· 3932 3934 return err 3933 3935 } 3934 3936 3935 - if uint64(len(t.Name)) > cbg.MaxLength { 3937 + if len(t.Name) > 1000000 { 3936 3938 return xerrors.Errorf("Value in field t.Name was too long") 3937 3939 } 3938 3940 ··· 3944 3946 } 3945 3947 3946 3948 // t.LexiconTypeID (string) (string) 3947 - if uint64(len("$type")) > cbg.MaxLength { 3949 + if len("$type") > 1000000 { 3948 3950 return xerrors.Errorf("Value in field \"$type\" was too long") 3949 3951 } 3950 3952 ··· 3965 3967 // t.Avatar (util.LexBlob) (struct) 3966 3968 if t.Avatar != nil { 3967 3969 3968 - if uint64(len("avatar")) > cbg.MaxLength { 3970 + if len("avatar") > 1000000 { 3969 3971 return xerrors.Errorf("Value in field \"avatar\" was too long") 3970 3972 } 3971 3973 ··· 3984 3986 // t.Labels (bsky.GraphList_Labels) (struct) 3985 3987 if t.Labels != nil { 3986 3988 3987 - if uint64(len("labels")) > cbg.MaxLength { 3989 + if len("labels") > 1000000 { 3988 3990 return xerrors.Errorf("Value in field \"labels\" was too long") 3989 3991 } 3990 3992 ··· 4001 4003 } 4002 4004 4003 4005 // t.Purpose (string) (string) 4004 - if uint64(len("purpose")) > cbg.MaxLength { 4006 + if len("purpose") > 1000000 { 4005 4007 return xerrors.Errorf("Value in field \"purpose\" was too long") 4006 4008 } 4007 4009 ··· 4017 4019 return err 4018 4020 } 4019 4021 } else { 4020 - if uint64(len(*t.Purpose)) > cbg.MaxLength { 4022 + if len(*t.Purpose) > 1000000 { 4021 4023 return xerrors.Errorf("Value in field t.Purpose was too long") 4022 4024 } 4023 4025 ··· 4030 4032 } 4031 4033 4032 4034 // t.CreatedAt (string) (string) 4033 - if uint64(len("createdAt")) > cbg.MaxLength { 4035 + if len("createdAt") > 1000000 { 4034 4036 return xerrors.Errorf("Value in field \"createdAt\" was too long") 4035 4037 } 4036 4038 ··· 4041 4043 return err 4042 4044 } 4043 4045 4044 - if uint64(len(t.CreatedAt)) > cbg.MaxLength { 4046 + if len(t.CreatedAt) > 1000000 { 4045 4047 return xerrors.Errorf("Value in field t.CreatedAt was too long") 4046 4048 } 4047 4049 ··· 4055 4057 // t.Description (string) (string) 4056 4058 if t.Description != nil { 4057 4059 4058 - if uint64(len("description")) > cbg.MaxLength { 4060 + if len("description") > 1000000 { 4059 4061 return xerrors.Errorf("Value in field \"description\" was too long") 4060 4062 } 4061 4063 ··· 4071 4073 return err 4072 4074 } 4073 4075 } else { 4074 - if uint64(len(*t.Description)) > cbg.MaxLength { 4076 + if len(*t.Description) > 1000000 { 4075 4077 return xerrors.Errorf("Value in field t.Description was too long") 4076 4078 } 4077 4079 ··· 4087 4089 // t.DescriptionFacets ([]*bsky.RichtextFacet) (slice) 4088 4090 if t.DescriptionFacets != nil { 4089 4091 4090 - if uint64(len("descriptionFacets")) > cbg.MaxLength { 4092 + if len("descriptionFacets") > 1000000 { 4091 4093 return xerrors.Errorf("Value in field \"descriptionFacets\" was too long") 4092 4094 } 4093 4095 ··· 4098 4100 return err 4099 4101 } 4100 4102 4101 - if uint64(len(t.DescriptionFacets)) > cbg.MaxLength { 4103 + if len(t.DescriptionFacets) > 8192 { 4102 4104 return xerrors.Errorf("Slice value in field t.DescriptionFacets was too long") 4103 4105 } 4104 4106 ··· 4144 4146 for i := uint64(0); i < n; i++ { 4145 4147 4146 4148 { 4147 - sval, err := cbg.ReadString(cr) 4149 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 4148 4150 if err != nil { 4149 4151 return err 4150 4152 } ··· 4157 4159 case "name": 4158 4160 4159 4161 { 4160 - sval, err := cbg.ReadString(cr) 4162 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 4161 4163 if err != nil { 4162 4164 return err 4163 4165 } ··· 4168 4170 case "$type": 4169 4171 4170 4172 { 4171 - sval, err := cbg.ReadString(cr) 4173 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 4172 4174 if err != nil { 4173 4175 return err 4174 4176 } ··· 4228 4230 return err 4229 4231 } 4230 4232 4231 - sval, err := cbg.ReadString(cr) 4233 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 4232 4234 if err != nil { 4233 4235 return err 4234 4236 } ··· 4240 4242 case "createdAt": 4241 4243 4242 4244 { 4243 - sval, err := cbg.ReadString(cr) 4245 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 4244 4246 if err != nil { 4245 4247 return err 4246 4248 } ··· 4260 4262 return err 4261 4263 } 4262 4264 4263 - sval, err := cbg.ReadString(cr) 4265 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 4264 4266 if err != nil { 4265 4267 return err 4266 4268 } ··· 4276 4278 return err 4277 4279 } 4278 4280 4279 - if extra > cbg.MaxLength { 4281 + if extra > 8192 { 4280 4282 return fmt.Errorf("t.DescriptionFacets: array too large (%d)", extra) 4281 4283 } 4282 4284 ··· 4339 4341 } 4340 4342 4341 4343 // t.List (string) (string) 4342 - if uint64(len("list")) > cbg.MaxLength { 4344 + if len("list") > 1000000 { 4343 4345 return xerrors.Errorf("Value in field \"list\" was too long") 4344 4346 } 4345 4347 ··· 4350 4352 return err 4351 4353 } 4352 4354 4353 - if uint64(len(t.List)) > cbg.MaxLength { 4355 + if len(t.List) > 1000000 { 4354 4356 return xerrors.Errorf("Value in field t.List was too long") 4355 4357 } 4356 4358 ··· 4362 4364 } 4363 4365 4364 4366 // t.LexiconTypeID (string) (string) 4365 - if uint64(len("$type")) > cbg.MaxLength { 4367 + if len("$type") > 1000000 { 4366 4368 return xerrors.Errorf("Value in field \"$type\" was too long") 4367 4369 } 4368 4370 ··· 4381 4383 } 4382 4384 4383 4385 // t.Subject (string) (string) 4384 - if uint64(len("subject")) > cbg.MaxLength { 4386 + if len("subject") > 1000000 { 4385 4387 return xerrors.Errorf("Value in field \"subject\" was too long") 4386 4388 } 4387 4389 ··· 4392 4394 return err 4393 4395 } 4394 4396 4395 - if uint64(len(t.Subject)) > cbg.MaxLength { 4397 + if len(t.Subject) > 1000000 { 4396 4398 return xerrors.Errorf("Value in field t.Subject was too long") 4397 4399 } 4398 4400 ··· 4404 4406 } 4405 4407 4406 4408 // t.CreatedAt (string) (string) 4407 - if uint64(len("createdAt")) > cbg.MaxLength { 4409 + if len("createdAt") > 1000000 { 4408 4410 return xerrors.Errorf("Value in field \"createdAt\" was too long") 4409 4411 } 4410 4412 ··· 4415 4417 return err 4416 4418 } 4417 4419 4418 - if uint64(len(t.CreatedAt)) > cbg.MaxLength { 4420 + if len(t.CreatedAt) > 1000000 { 4419 4421 return xerrors.Errorf("Value in field t.CreatedAt was too long") 4420 4422 } 4421 4423 ··· 4457 4459 for i := uint64(0); i < n; i++ { 4458 4460 4459 4461 { 4460 - sval, err := cbg.ReadString(cr) 4462 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 4461 4463 if err != nil { 4462 4464 return err 4463 4465 } ··· 4470 4472 case "list": 4471 4473 4472 4474 { 4473 - sval, err := cbg.ReadString(cr) 4475 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 4474 4476 if err != nil { 4475 4477 return err 4476 4478 } ··· 4481 4483 case "$type": 4482 4484 4483 4485 { 4484 - sval, err := cbg.ReadString(cr) 4486 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 4485 4487 if err != nil { 4486 4488 return err 4487 4489 } ··· 4492 4494 case "subject": 4493 4495 4494 4496 { 4495 - sval, err := cbg.ReadString(cr) 4497 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 4496 4498 if err != nil { 4497 4499 return err 4498 4500 } ··· 4503 4505 case "createdAt": 4504 4506 4505 4507 { 4506 - sval, err := cbg.ReadString(cr) 4508 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 4507 4509 if err != nil { 4508 4510 return err 4509 4511 } ··· 4549 4551 } 4550 4552 4551 4553 // t.Did (string) (string) 4552 - if uint64(len("did")) > cbg.MaxLength { 4554 + if len("did") > 1000000 { 4553 4555 return xerrors.Errorf("Value in field \"did\" was too long") 4554 4556 } 4555 4557 ··· 4560 4562 return err 4561 4563 } 4562 4564 4563 - if uint64(len(t.Did)) > cbg.MaxLength { 4565 + if len(t.Did) > 1000000 { 4564 4566 return xerrors.Errorf("Value in field t.Did was too long") 4565 4567 } 4566 4568 ··· 4572 4574 } 4573 4575 4574 4576 // t.LexiconTypeID (string) (string) 4575 - if uint64(len("$type")) > cbg.MaxLength { 4577 + if len("$type") > 1000000 { 4576 4578 return xerrors.Errorf("Value in field \"$type\" was too long") 4577 4579 } 4578 4580 ··· 4593 4595 // t.Avatar (util.LexBlob) (struct) 4594 4596 if t.Avatar != nil { 4595 4597 4596 - if uint64(len("avatar")) > cbg.MaxLength { 4598 + if len("avatar") > 1000000 { 4597 4599 return xerrors.Errorf("Value in field \"avatar\" was too long") 4598 4600 } 4599 4601 ··· 4612 4614 // t.Labels (bsky.FeedGenerator_Labels) (struct) 4613 4615 if t.Labels != nil { 4614 4616 4615 - if uint64(len("labels")) > cbg.MaxLength { 4617 + if len("labels") > 1000000 { 4616 4618 return xerrors.Errorf("Value in field \"labels\" was too long") 4617 4619 } 4618 4620 ··· 4629 4631 } 4630 4632 4631 4633 // t.CreatedAt (string) (string) 4632 - if uint64(len("createdAt")) > cbg.MaxLength { 4634 + if len("createdAt") > 1000000 { 4633 4635 return xerrors.Errorf("Value in field \"createdAt\" was too long") 4634 4636 } 4635 4637 ··· 4640 4642 return err 4641 4643 } 4642 4644 4643 - if uint64(len(t.CreatedAt)) > cbg.MaxLength { 4645 + if len(t.CreatedAt) > 1000000 { 4644 4646 return xerrors.Errorf("Value in field t.CreatedAt was too long") 4645 4647 } 4646 4648 ··· 4654 4656 // t.Description (string) (string) 4655 4657 if t.Description != nil { 4656 4658 4657 - if uint64(len("description")) > cbg.MaxLength { 4659 + if len("description") > 1000000 { 4658 4660 return xerrors.Errorf("Value in field \"description\" was too long") 4659 4661 } 4660 4662 ··· 4670 4672 return err 4671 4673 } 4672 4674 } else { 4673 - if uint64(len(*t.Description)) > cbg.MaxLength { 4675 + if len(*t.Description) > 1000000 { 4674 4676 return xerrors.Errorf("Value in field t.Description was too long") 4675 4677 } 4676 4678 ··· 4684 4686 } 4685 4687 4686 4688 // t.DisplayName (string) (string) 4687 - if uint64(len("displayName")) > cbg.MaxLength { 4689 + if len("displayName") > 1000000 { 4688 4690 return xerrors.Errorf("Value in field \"displayName\" was too long") 4689 4691 } 4690 4692 ··· 4695 4697 return err 4696 4698 } 4697 4699 4698 - if uint64(len(t.DisplayName)) > cbg.MaxLength { 4700 + if len(t.DisplayName) > 1000000 { 4699 4701 return xerrors.Errorf("Value in field t.DisplayName was too long") 4700 4702 } 4701 4703 ··· 4709 4711 // t.DescriptionFacets ([]*bsky.RichtextFacet) (slice) 4710 4712 if t.DescriptionFacets != nil { 4711 4713 4712 - if uint64(len("descriptionFacets")) > cbg.MaxLength { 4714 + if len("descriptionFacets") > 1000000 { 4713 4715 return xerrors.Errorf("Value in field \"descriptionFacets\" was too long") 4714 4716 } 4715 4717 ··· 4720 4722 return err 4721 4723 } 4722 4724 4723 - if uint64(len(t.DescriptionFacets)) > cbg.MaxLength { 4725 + if len(t.DescriptionFacets) > 8192 { 4724 4726 return xerrors.Errorf("Slice value in field t.DescriptionFacets was too long") 4725 4727 } 4726 4728 ··· 4766 4768 for i := uint64(0); i < n; i++ { 4767 4769 4768 4770 { 4769 - sval, err := cbg.ReadString(cr) 4771 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 4770 4772 if err != nil { 4771 4773 return err 4772 4774 } ··· 4779 4781 case "did": 4780 4782 4781 4783 { 4782 - sval, err := cbg.ReadString(cr) 4784 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 4783 4785 if err != nil { 4784 4786 return err 4785 4787 } ··· 4790 4792 case "$type": 4791 4793 4792 4794 { 4793 - sval, err := cbg.ReadString(cr) 4795 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 4794 4796 if err != nil { 4795 4797 return err 4796 4798 } ··· 4841 4843 case "createdAt": 4842 4844 4843 4845 { 4844 - sval, err := cbg.ReadString(cr) 4846 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 4845 4847 if err != nil { 4846 4848 return err 4847 4849 } ··· 4861 4863 return err 4862 4864 } 4863 4865 4864 - sval, err := cbg.ReadString(cr) 4866 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 4865 4867 if err != nil { 4866 4868 return err 4867 4869 } ··· 4873 4875 case "displayName": 4874 4876 4875 4877 { 4876 - sval, err := cbg.ReadString(cr) 4878 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 4877 4879 if err != nil { 4878 4880 return err 4879 4881 } ··· 4888 4890 return err 4889 4891 } 4890 4892 4891 - if extra > cbg.MaxLength { 4893 + if extra > 8192 { 4892 4894 return fmt.Errorf("t.DescriptionFacets: array too large (%d)", extra) 4893 4895 } 4894 4896 ··· 4951 4953 } 4952 4954 4953 4955 // t.LexiconTypeID (string) (string) 4954 - if uint64(len("$type")) > cbg.MaxLength { 4956 + if len("$type") > 1000000 { 4955 4957 return xerrors.Errorf("Value in field \"$type\" was too long") 4956 4958 } 4957 4959 ··· 4970 4972 } 4971 4973 4972 4974 // t.Subject (string) (string) 4973 - if uint64(len("subject")) > cbg.MaxLength { 4975 + if len("subject") > 1000000 { 4974 4976 return xerrors.Errorf("Value in field \"subject\" was too long") 4975 4977 } 4976 4978 ··· 4981 4983 return err 4982 4984 } 4983 4985 4984 - if uint64(len(t.Subject)) > cbg.MaxLength { 4986 + if len(t.Subject) > 1000000 { 4985 4987 return xerrors.Errorf("Value in field t.Subject was too long") 4986 4988 } 4987 4989 ··· 4993 4995 } 4994 4996 4995 4997 // t.CreatedAt (string) (string) 4996 - if uint64(len("createdAt")) > cbg.MaxLength { 4998 + if len("createdAt") > 1000000 { 4997 4999 return xerrors.Errorf("Value in field \"createdAt\" was too long") 4998 5000 } 4999 5001 ··· 5004 5006 return err 5005 5007 } 5006 5008 5007 - if uint64(len(t.CreatedAt)) > cbg.MaxLength { 5009 + if len(t.CreatedAt) > 1000000 { 5008 5010 return xerrors.Errorf("Value in field t.CreatedAt was too long") 5009 5011 } 5010 5012 ··· 5046 5048 for i := uint64(0); i < n; i++ { 5047 5049 5048 5050 { 5049 - sval, err := cbg.ReadString(cr) 5051 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 5050 5052 if err != nil { 5051 5053 return err 5052 5054 } ··· 5059 5061 case "$type": 5060 5062 5061 5063 { 5062 - sval, err := cbg.ReadString(cr) 5064 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 5063 5065 if err != nil { 5064 5066 return err 5065 5067 } ··· 5070 5072 case "subject": 5071 5073 5072 5074 { 5073 - sval, err := cbg.ReadString(cr) 5075 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 5074 5076 if err != nil { 5075 5077 return err 5076 5078 } ··· 5081 5083 case "createdAt": 5082 5084 5083 5085 { 5084 - sval, err := cbg.ReadString(cr) 5086 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 5085 5087 if err != nil { 5086 5088 return err 5087 5089 } ··· 5110 5112 } 5111 5113 5112 5114 // t.Width (int64) (int64) 5113 - if uint64(len("width")) > cbg.MaxLength { 5115 + if len("width") > 1000000 { 5114 5116 return xerrors.Errorf("Value in field \"width\" was too long") 5115 5117 } 5116 5118 ··· 5132 5134 } 5133 5135 5134 5136 // t.Height (int64) (int64) 5135 - if uint64(len("height")) > cbg.MaxLength { 5137 + if len("height") > 1000000 { 5136 5138 return xerrors.Errorf("Value in field \"height\" was too long") 5137 5139 } 5138 5140 ··· 5152 5154 return err 5153 5155 } 5154 5156 } 5157 + 5155 5158 return nil 5156 5159 } 5157 5160 ··· 5184 5187 for i := uint64(0); i < n; i++ { 5185 5188 5186 5189 { 5187 - sval, err := cbg.ReadString(cr) 5190 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 5188 5191 if err != nil { 5189 5192 return err 5190 5193 } ··· 5197 5200 case "width": 5198 5201 { 5199 5202 maj, extra, err := cr.ReadHeader() 5200 - var extraI int64 5201 5203 if err != nil { 5202 5204 return err 5203 5205 } 5206 + var extraI int64 5204 5207 switch maj { 5205 5208 case cbg.MajUnsignedInt: 5206 5209 extraI = int64(extra) ··· 5223 5226 case "height": 5224 5227 { 5225 5228 maj, extra, err := cr.ReadHeader() 5226 - var extraI int64 5227 5229 if err != nil { 5228 5230 return err 5229 5231 } 5232 + var extraI int64 5230 5233 switch maj { 5231 5234 case cbg.MajUnsignedInt: 5232 5235 extraI = int64(extra) ··· 5272 5275 } 5273 5276 5274 5277 // t.Post (string) (string) 5275 - if uint64(len("post")) > cbg.MaxLength { 5278 + if len("post") > 1000000 { 5276 5279 return xerrors.Errorf("Value in field \"post\" was too long") 5277 5280 } 5278 5281 ··· 5283 5286 return err 5284 5287 } 5285 5288 5286 - if uint64(len(t.Post)) > cbg.MaxLength { 5289 + if len(t.Post) > 1000000 { 5287 5290 return xerrors.Errorf("Value in field t.Post was too long") 5288 5291 } 5289 5292 ··· 5295 5298 } 5296 5299 5297 5300 // t.LexiconTypeID (string) (string) 5298 - if uint64(len("$type")) > cbg.MaxLength { 5301 + if len("$type") > 1000000 { 5299 5302 return xerrors.Errorf("Value in field \"$type\" was too long") 5300 5303 } 5301 5304 ··· 5316 5319 // t.Allow ([]*bsky.FeedThreadgate_Allow_Elem) (slice) 5317 5320 if t.Allow != nil { 5318 5321 5319 - if uint64(len("allow")) > cbg.MaxLength { 5322 + if len("allow") > 1000000 { 5320 5323 return xerrors.Errorf("Value in field \"allow\" was too long") 5321 5324 } 5322 5325 ··· 5327 5330 return err 5328 5331 } 5329 5332 5330 - if uint64(len(t.Allow)) > cbg.MaxLength { 5333 + if len(t.Allow) > 8192 { 5331 5334 return xerrors.Errorf("Slice value in field t.Allow was too long") 5332 5335 } 5333 5336 ··· 5343 5346 } 5344 5347 5345 5348 // t.CreatedAt (string) (string) 5346 - if uint64(len("createdAt")) > cbg.MaxLength { 5349 + if len("createdAt") > 1000000 { 5347 5350 return xerrors.Errorf("Value in field \"createdAt\" was too long") 5348 5351 } 5349 5352 ··· 5354 5357 return err 5355 5358 } 5356 5359 5357 - if uint64(len(t.CreatedAt)) > cbg.MaxLength { 5360 + if len(t.CreatedAt) > 1000000 { 5358 5361 return xerrors.Errorf("Value in field t.CreatedAt was too long") 5359 5362 } 5360 5363 ··· 5396 5399 for i := uint64(0); i < n; i++ { 5397 5400 5398 5401 { 5399 - sval, err := cbg.ReadString(cr) 5402 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 5400 5403 if err != nil { 5401 5404 return err 5402 5405 } ··· 5409 5412 case "post": 5410 5413 5411 5414 { 5412 - sval, err := cbg.ReadString(cr) 5415 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 5413 5416 if err != nil { 5414 5417 return err 5415 5418 } ··· 5420 5423 case "$type": 5421 5424 5422 5425 { 5423 - sval, err := cbg.ReadString(cr) 5426 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 5424 5427 if err != nil { 5425 5428 return err 5426 5429 } ··· 5435 5438 return err 5436 5439 } 5437 5440 5438 - if extra > cbg.MaxLength { 5441 + if extra > 8192 { 5439 5442 return fmt.Errorf("t.Allow: array too large (%d)", extra) 5440 5443 } 5441 5444 ··· 5480 5483 case "createdAt": 5481 5484 5482 5485 { 5483 - sval, err := cbg.ReadString(cr) 5486 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 5484 5487 if err != nil { 5485 5488 return err 5486 5489 } ··· 5509 5512 } 5510 5513 5511 5514 // t.List (string) (string) 5512 - if uint64(len("list")) > cbg.MaxLength { 5515 + if len("list") > 1000000 { 5513 5516 return xerrors.Errorf("Value in field \"list\" was too long") 5514 5517 } 5515 5518 ··· 5520 5523 return err 5521 5524 } 5522 5525 5523 - if uint64(len(t.List)) > cbg.MaxLength { 5526 + if len(t.List) > 1000000 { 5524 5527 return xerrors.Errorf("Value in field t.List was too long") 5525 5528 } 5526 5529 ··· 5532 5535 } 5533 5536 5534 5537 // t.LexiconTypeID (string) (string) 5535 - if uint64(len("$type")) > cbg.MaxLength { 5538 + if len("$type") > 1000000 { 5536 5539 return xerrors.Errorf("Value in field \"$type\" was too long") 5537 5540 } 5538 5541 ··· 5581 5584 for i := uint64(0); i < n; i++ { 5582 5585 5583 5586 { 5584 - sval, err := cbg.ReadString(cr) 5587 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 5585 5588 if err != nil { 5586 5589 return err 5587 5590 } ··· 5594 5597 case "list": 5595 5598 5596 5599 { 5597 - sval, err := cbg.ReadString(cr) 5600 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 5598 5601 if err != nil { 5599 5602 return err 5600 5603 } ··· 5605 5608 case "$type": 5606 5609 5607 5610 { 5608 - sval, err := cbg.ReadString(cr) 5611 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 5609 5612 if err != nil { 5610 5613 return err 5611 5614 } ··· 5634 5637 } 5635 5638 5636 5639 // t.LexiconTypeID (string) (string) 5637 - if uint64(len("$type")) > cbg.MaxLength { 5640 + if len("$type") > 1000000 { 5638 5641 return xerrors.Errorf("Value in field \"$type\" was too long") 5639 5642 } 5640 5643 ··· 5683 5686 for i := uint64(0); i < n; i++ { 5684 5687 5685 5688 { 5686 - sval, err := cbg.ReadString(cr) 5689 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 5687 5690 if err != nil { 5688 5691 return err 5689 5692 } ··· 5696 5699 case "$type": 5697 5700 5698 5701 { 5699 - sval, err := cbg.ReadString(cr) 5702 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 5700 5703 if err != nil { 5701 5704 return err 5702 5705 } ··· 5725 5728 } 5726 5729 5727 5730 // t.LexiconTypeID (string) (string) 5728 - if uint64(len("$type")) > cbg.MaxLength { 5731 + if len("$type") > 1000000 { 5729 5732 return xerrors.Errorf("Value in field \"$type\" was too long") 5730 5733 } 5731 5734 ··· 5774 5777 for i := uint64(0); i < n; i++ { 5775 5778 5776 5779 { 5777 - sval, err := cbg.ReadString(cr) 5780 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 5778 5781 if err != nil { 5779 5782 return err 5780 5783 } ··· 5787 5790 case "$type": 5788 5791 5789 5792 { 5790 - sval, err := cbg.ReadString(cr) 5793 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 5791 5794 if err != nil { 5792 5795 return err 5793 5796 } ··· 5821 5824 } 5822 5825 5823 5826 // t.LexiconTypeID (string) (string) 5824 - if uint64(len("$type")) > cbg.MaxLength { 5827 + if len("$type") > 1000000 { 5825 5828 return xerrors.Errorf("Value in field \"$type\" was too long") 5826 5829 } 5827 5830 ··· 5842 5845 // t.Labels (bsky.LabelerService_Labels) (struct) 5843 5846 if t.Labels != nil { 5844 5847 5845 - if uint64(len("labels")) > cbg.MaxLength { 5848 + if len("labels") > 1000000 { 5846 5849 return xerrors.Errorf("Value in field \"labels\" was too long") 5847 5850 } 5848 5851 ··· 5859 5862 } 5860 5863 5861 5864 // t.Policies (bsky.LabelerDefs_LabelerPolicies) (struct) 5862 - if uint64(len("policies")) > cbg.MaxLength { 5865 + if len("policies") > 1000000 { 5863 5866 return xerrors.Errorf("Value in field \"policies\" was too long") 5864 5867 } 5865 5868 ··· 5875 5878 } 5876 5879 5877 5880 // t.CreatedAt (string) (string) 5878 - if uint64(len("createdAt")) > cbg.MaxLength { 5881 + if len("createdAt") > 1000000 { 5879 5882 return xerrors.Errorf("Value in field \"createdAt\" was too long") 5880 5883 } 5881 5884 ··· 5886 5889 return err 5887 5890 } 5888 5891 5889 - if uint64(len(t.CreatedAt)) > cbg.MaxLength { 5892 + if len(t.CreatedAt) > 1000000 { 5890 5893 return xerrors.Errorf("Value in field t.CreatedAt was too long") 5891 5894 } 5892 5895 ··· 5928 5931 for i := uint64(0); i < n; i++ { 5929 5932 5930 5933 { 5931 - sval, err := cbg.ReadString(cr) 5934 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 5932 5935 if err != nil { 5933 5936 return err 5934 5937 } ··· 5941 5944 case "$type": 5942 5945 5943 5946 { 5944 - sval, err := cbg.ReadString(cr) 5947 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 5945 5948 if err != nil { 5946 5949 return err 5947 5950 } ··· 5992 5995 case "createdAt": 5993 5996 5994 5997 { 5995 - sval, err := cbg.ReadString(cr) 5998 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 5996 5999 if err != nil { 5997 6000 return err 5998 6001 } ··· 6026 6029 } 6027 6030 6028 6031 // t.LabelValues ([]*string) (slice) 6029 - if uint64(len("labelValues")) > cbg.MaxLength { 6032 + if len("labelValues") > 1000000 { 6030 6033 return xerrors.Errorf("Value in field \"labelValues\" was too long") 6031 6034 } 6032 6035 ··· 6037 6040 return err 6038 6041 } 6039 6042 6040 - if uint64(len(t.LabelValues)) > cbg.MaxLength { 6043 + if len(t.LabelValues) > 8192 { 6041 6044 return xerrors.Errorf("Slice value in field t.LabelValues was too long") 6042 6045 } 6043 6046 ··· 6050 6053 return err 6051 6054 } 6052 6055 } else { 6053 - if uint64(len(*v)) > cbg.MaxLength { 6056 + if len(*v) > 1000000 { 6054 6057 return xerrors.Errorf("Value in field v was too long") 6055 6058 } 6056 6059 ··· 6067 6070 // t.LabelValueDefinitions ([]*atproto.LabelDefs_LabelValueDefinition) (slice) 6068 6071 if t.LabelValueDefinitions != nil { 6069 6072 6070 - if uint64(len("labelValueDefinitions")) > cbg.MaxLength { 6073 + if len("labelValueDefinitions") > 1000000 { 6071 6074 return xerrors.Errorf("Value in field \"labelValueDefinitions\" was too long") 6072 6075 } 6073 6076 ··· 6078 6081 return err 6079 6082 } 6080 6083 6081 - if uint64(len(t.LabelValueDefinitions)) > cbg.MaxLength { 6084 + if len(t.LabelValueDefinitions) > 8192 { 6082 6085 return xerrors.Errorf("Slice value in field t.LabelValueDefinitions was too long") 6083 6086 } 6084 6087 ··· 6124 6127 for i := uint64(0); i < n; i++ { 6125 6128 6126 6129 { 6127 - sval, err := cbg.ReadString(cr) 6130 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 6128 6131 if err != nil { 6129 6132 return err 6130 6133 } ··· 6141 6144 return err 6142 6145 } 6143 6146 6144 - if extra > cbg.MaxLength { 6147 + if extra > 8192 { 6145 6148 return fmt.Errorf("t.LabelValues: array too large (%d)", extra) 6146 6149 } 6147 6150 ··· 6163 6166 _ = err 6164 6167 6165 6168 { 6166 - sval, err := cbg.ReadString(cr) 6169 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 6167 6170 if err != nil { 6168 6171 return err 6169 6172 } ··· 6181 6184 return err 6182 6185 } 6183 6186 6184 - if extra > cbg.MaxLength { 6187 + if extra > 8192 { 6185 6188 return fmt.Errorf("t.LabelValueDefinitions: array too large (%d)", extra) 6186 6189 } 6187 6190
+22 -22
api/cbor_gen.go
··· 38 38 // t.Sig (string) (string) 39 39 if t.Sig != "" { 40 40 41 - if uint64(len("sig")) > cbg.MaxLength { 41 + if len("sig") > 1000000 { 42 42 return xerrors.Errorf("Value in field \"sig\" was too long") 43 43 } 44 44 ··· 49 49 return err 50 50 } 51 51 52 - if uint64(len(t.Sig)) > cbg.MaxLength { 52 + if len(t.Sig) > 1000000 { 53 53 return xerrors.Errorf("Value in field t.Sig was too long") 54 54 } 55 55 ··· 62 62 } 63 63 64 64 // t.Prev (string) (string) 65 - if uint64(len("prev")) > cbg.MaxLength { 65 + if len("prev") > 1000000 { 66 66 return xerrors.Errorf("Value in field \"prev\" was too long") 67 67 } 68 68 ··· 78 78 return err 79 79 } 80 80 } else { 81 - if uint64(len(*t.Prev)) > cbg.MaxLength { 81 + if len(*t.Prev) > 1000000 { 82 82 return xerrors.Errorf("Value in field t.Prev was too long") 83 83 } 84 84 ··· 91 91 } 92 92 93 93 // t.Type (string) (string) 94 - if uint64(len("type")) > cbg.MaxLength { 94 + if len("type") > 1000000 { 95 95 return xerrors.Errorf("Value in field \"type\" was too long") 96 96 } 97 97 ··· 102 102 return err 103 103 } 104 104 105 - if uint64(len(t.Type)) > cbg.MaxLength { 105 + if len(t.Type) > 1000000 { 106 106 return xerrors.Errorf("Value in field t.Type was too long") 107 107 } 108 108 ··· 114 114 } 115 115 116 116 // t.Handle (string) (string) 117 - if uint64(len("handle")) > cbg.MaxLength { 117 + if len("handle") > 1000000 { 118 118 return xerrors.Errorf("Value in field \"handle\" was too long") 119 119 } 120 120 ··· 125 125 return err 126 126 } 127 127 128 - if uint64(len(t.Handle)) > cbg.MaxLength { 128 + if len(t.Handle) > 1000000 { 129 129 return xerrors.Errorf("Value in field t.Handle was too long") 130 130 } 131 131 ··· 137 137 } 138 138 139 139 // t.Service (string) (string) 140 - if uint64(len("service")) > cbg.MaxLength { 140 + if len("service") > 1000000 { 141 141 return xerrors.Errorf("Value in field \"service\" was too long") 142 142 } 143 143 ··· 148 148 return err 149 149 } 150 150 151 - if uint64(len(t.Service)) > cbg.MaxLength { 151 + if len(t.Service) > 1000000 { 152 152 return xerrors.Errorf("Value in field t.Service was too long") 153 153 } 154 154 ··· 160 160 } 161 161 162 162 // t.SigningKey (string) (string) 163 - if uint64(len("signingKey")) > cbg.MaxLength { 163 + if len("signingKey") > 1000000 { 164 164 return xerrors.Errorf("Value in field \"signingKey\" was too long") 165 165 } 166 166 ··· 171 171 return err 172 172 } 173 173 174 - if uint64(len(t.SigningKey)) > cbg.MaxLength { 174 + if len(t.SigningKey) > 1000000 { 175 175 return xerrors.Errorf("Value in field t.SigningKey was too long") 176 176 } 177 177 ··· 183 183 } 184 184 185 185 // t.RecoveryKey (string) (string) 186 - if uint64(len("recoveryKey")) > cbg.MaxLength { 186 + if len("recoveryKey") > 1000000 { 187 187 return xerrors.Errorf("Value in field \"recoveryKey\" was too long") 188 188 } 189 189 ··· 194 194 return err 195 195 } 196 196 197 - if uint64(len(t.RecoveryKey)) > cbg.MaxLength { 197 + if len(t.RecoveryKey) > 1000000 { 198 198 return xerrors.Errorf("Value in field t.RecoveryKey was too long") 199 199 } 200 200 ··· 236 236 for i := uint64(0); i < n; i++ { 237 237 238 238 { 239 - sval, err := cbg.ReadString(cr) 239 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 240 240 if err != nil { 241 241 return err 242 242 } ··· 249 249 case "sig": 250 250 251 251 { 252 - sval, err := cbg.ReadString(cr) 252 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 253 253 if err != nil { 254 254 return err 255 255 } ··· 269 269 return err 270 270 } 271 271 272 - sval, err := cbg.ReadString(cr) 272 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 273 273 if err != nil { 274 274 return err 275 275 } ··· 281 281 case "type": 282 282 283 283 { 284 - sval, err := cbg.ReadString(cr) 284 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 285 285 if err != nil { 286 286 return err 287 287 } ··· 292 292 case "handle": 293 293 294 294 { 295 - sval, err := cbg.ReadString(cr) 295 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 296 296 if err != nil { 297 297 return err 298 298 } ··· 303 303 case "service": 304 304 305 305 { 306 - sval, err := cbg.ReadString(cr) 306 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 307 307 if err != nil { 308 308 return err 309 309 } ··· 314 314 case "signingKey": 315 315 316 316 { 317 - sval, err := cbg.ReadString(cr) 317 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 318 318 if err != nil { 319 319 return err 320 320 } ··· 325 325 case "recoveryKey": 326 326 327 327 { 328 - sval, err := cbg.ReadString(cr) 328 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 329 329 if err != nil { 330 330 return err 331 331 }
+20 -20
atproto/data/cbor_gen.go
··· 31 31 } 32 32 33 33 // t.Type (string) (string) 34 - if uint64(len("$type")) > cbg.MaxLength { 34 + if len("$type") > 1000000 { 35 35 return xerrors.Errorf("Value in field \"$type\" was too long") 36 36 } 37 37 ··· 42 42 return err 43 43 } 44 44 45 - if uint64(len(t.Type)) > cbg.MaxLength { 45 + if len(t.Type) > 1000000 { 46 46 return xerrors.Errorf("Value in field t.Type was too long") 47 47 } 48 48 ··· 84 84 for i := uint64(0); i < n; i++ { 85 85 86 86 { 87 - sval, err := cbg.ReadString(cr) 87 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 88 88 if err != nil { 89 89 return err 90 90 } ··· 97 97 case "$type": 98 98 99 99 { 100 - sval, err := cbg.ReadString(cr) 100 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 101 101 if err != nil { 102 102 return err 103 103 } ··· 126 126 } 127 127 128 128 // t.Cid (string) (string) 129 - if uint64(len("cid")) > cbg.MaxLength { 129 + if len("cid") > 1000000 { 130 130 return xerrors.Errorf("Value in field \"cid\" was too long") 131 131 } 132 132 ··· 137 137 return err 138 138 } 139 139 140 - if uint64(len(t.Cid)) > cbg.MaxLength { 140 + if len(t.Cid) > 1000000 { 141 141 return xerrors.Errorf("Value in field t.Cid was too long") 142 142 } 143 143 ··· 149 149 } 150 150 151 151 // t.MimeType (string) (string) 152 - if uint64(len("mimeType")) > cbg.MaxLength { 152 + if len("mimeType") > 1000000 { 153 153 return xerrors.Errorf("Value in field \"mimeType\" was too long") 154 154 } 155 155 ··· 160 160 return err 161 161 } 162 162 163 - if uint64(len(t.MimeType)) > cbg.MaxLength { 163 + if len(t.MimeType) > 1000000 { 164 164 return xerrors.Errorf("Value in field t.MimeType was too long") 165 165 } 166 166 ··· 202 202 for i := uint64(0); i < n; i++ { 203 203 204 204 { 205 - sval, err := cbg.ReadString(cr) 205 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 206 206 if err != nil { 207 207 return err 208 208 } ··· 215 215 case "cid": 216 216 217 217 { 218 - sval, err := cbg.ReadString(cr) 218 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 219 219 if err != nil { 220 220 return err 221 221 } ··· 226 226 case "mimeType": 227 227 228 228 { 229 - sval, err := cbg.ReadString(cr) 229 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 230 230 if err != nil { 231 231 return err 232 232 } ··· 255 255 } 256 256 257 257 // t.Ref (data.CIDLink) (struct) 258 - if uint64(len("ref")) > cbg.MaxLength { 258 + if len("ref") > 1000000 { 259 259 return xerrors.Errorf("Value in field \"ref\" was too long") 260 260 } 261 261 ··· 271 271 } 272 272 273 273 // t.Size (int64) (int64) 274 - if uint64(len("size")) > cbg.MaxLength { 274 + if len("size") > 1000000 { 275 275 return xerrors.Errorf("Value in field \"size\" was too long") 276 276 } 277 277 ··· 293 293 } 294 294 295 295 // t.LexiconTypeID (string) (string) 296 - if uint64(len("$type")) > cbg.MaxLength { 296 + if len("$type") > 1000000 { 297 297 return xerrors.Errorf("Value in field \"$type\" was too long") 298 298 } 299 299 ··· 312 312 } 313 313 314 314 // t.MimeType (string) (string) 315 - if uint64(len("mimeType")) > cbg.MaxLength { 315 + if len("mimeType") > 1000000 { 316 316 return xerrors.Errorf("Value in field \"mimeType\" was too long") 317 317 } 318 318 ··· 323 323 return err 324 324 } 325 325 326 - if uint64(len(t.MimeType)) > cbg.MaxLength { 326 + if len(t.MimeType) > 1000000 { 327 327 return xerrors.Errorf("Value in field t.MimeType was too long") 328 328 } 329 329 ··· 365 365 for i := uint64(0); i < n; i++ { 366 366 367 367 { 368 - sval, err := cbg.ReadString(cr) 368 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 369 369 if err != nil { 370 370 return err 371 371 } ··· 388 388 case "size": 389 389 { 390 390 maj, extra, err := cr.ReadHeader() 391 - var extraI int64 392 391 if err != nil { 393 392 return err 394 393 } 394 + var extraI int64 395 395 switch maj { 396 396 case cbg.MajUnsignedInt: 397 397 extraI = int64(extra) ··· 414 414 case "$type": 415 415 416 416 { 417 - sval, err := cbg.ReadString(cr) 417 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 418 418 if err != nil { 419 419 return err 420 420 } ··· 425 425 case "mimeType": 426 426 427 427 { 428 - sval, err := cbg.ReadString(cr) 428 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 429 429 if err != nil { 430 430 return err 431 431 }
+14 -13
events/cbor_gen.go
··· 31 31 } 32 32 33 33 // t.MsgType (string) (string) 34 - if uint64(len("t")) > cbg.MaxLength { 34 + if len("t") > 1000000 { 35 35 return xerrors.Errorf("Value in field \"t\" was too long") 36 36 } 37 37 ··· 42 42 return err 43 43 } 44 44 45 - if uint64(len(t.MsgType)) > cbg.MaxLength { 45 + if len(t.MsgType) > 1000000 { 46 46 return xerrors.Errorf("Value in field t.MsgType was too long") 47 47 } 48 48 ··· 54 54 } 55 55 56 56 // t.Op (int64) (int64) 57 - if uint64(len("op")) > cbg.MaxLength { 57 + if len("op") > 1000000 { 58 58 return xerrors.Errorf("Value in field \"op\" was too long") 59 59 } 60 60 ··· 74 74 return err 75 75 } 76 76 } 77 + 77 78 return nil 78 79 } 79 80 ··· 106 107 for i := uint64(0); i < n; i++ { 107 108 108 109 { 109 - sval, err := cbg.ReadString(cr) 110 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 110 111 if err != nil { 111 112 return err 112 113 } ··· 119 120 case "t": 120 121 121 122 { 122 - sval, err := cbg.ReadString(cr) 123 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 123 124 if err != nil { 124 125 return err 125 126 } ··· 130 131 case "op": 131 132 { 132 133 maj, extra, err := cr.ReadHeader() 133 - var extraI int64 134 134 if err != nil { 135 135 return err 136 136 } 137 + var extraI int64 137 138 switch maj { 138 139 case cbg.MajUnsignedInt: 139 140 extraI = int64(extra) ··· 174 175 } 175 176 176 177 // t.Error (string) (string) 177 - if uint64(len("error")) > cbg.MaxLength { 178 + if len("error") > 1000000 { 178 179 return xerrors.Errorf("Value in field \"error\" was too long") 179 180 } 180 181 ··· 185 186 return err 186 187 } 187 188 188 - if uint64(len(t.Error)) > cbg.MaxLength { 189 + if len(t.Error) > 1000000 { 189 190 return xerrors.Errorf("Value in field t.Error was too long") 190 191 } 191 192 ··· 197 198 } 198 199 199 200 // t.Message (string) (string) 200 - if uint64(len("message")) > cbg.MaxLength { 201 + if len("message") > 1000000 { 201 202 return xerrors.Errorf("Value in field \"message\" was too long") 202 203 } 203 204 ··· 208 209 return err 209 210 } 210 211 211 - if uint64(len(t.Message)) > cbg.MaxLength { 212 + if len(t.Message) > 1000000 { 212 213 return xerrors.Errorf("Value in field t.Message was too long") 213 214 } 214 215 ··· 250 251 for i := uint64(0); i < n; i++ { 251 252 252 253 { 253 - sval, err := cbg.ReadString(cr) 254 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 254 255 if err != nil { 255 256 return err 256 257 } ··· 263 264 case "error": 264 265 265 266 { 266 - sval, err := cbg.ReadString(cr) 267 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 267 268 if err != nil { 268 269 return err 269 270 } ··· 274 275 case "message": 275 276 276 277 { 277 - sval, err := cbg.ReadString(cr) 278 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 278 279 if err != nil { 279 280 return err 280 281 }
+20 -20
lex/util/cbor_gen.go
··· 31 31 } 32 32 33 33 // t.Type (string) (string) 34 - if uint64(len("$type")) > cbg.MaxLength { 34 + if len("$type") > 1000000 { 35 35 return xerrors.Errorf("Value in field \"$type\" was too long") 36 36 } 37 37 ··· 42 42 return err 43 43 } 44 44 45 - if uint64(len(t.Type)) > cbg.MaxLength { 45 + if len(t.Type) > 1000000 { 46 46 return xerrors.Errorf("Value in field t.Type was too long") 47 47 } 48 48 ··· 84 84 for i := uint64(0); i < n; i++ { 85 85 86 86 { 87 - sval, err := cbg.ReadString(cr) 87 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 88 88 if err != nil { 89 89 return err 90 90 } ··· 97 97 case "$type": 98 98 99 99 { 100 - sval, err := cbg.ReadString(cr) 100 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 101 101 if err != nil { 102 102 return err 103 103 } ··· 126 126 } 127 127 128 128 // t.Cid (string) (string) 129 - if uint64(len("cid")) > cbg.MaxLength { 129 + if len("cid") > 1000000 { 130 130 return xerrors.Errorf("Value in field \"cid\" was too long") 131 131 } 132 132 ··· 137 137 return err 138 138 } 139 139 140 - if uint64(len(t.Cid)) > cbg.MaxLength { 140 + if len(t.Cid) > 1000000 { 141 141 return xerrors.Errorf("Value in field t.Cid was too long") 142 142 } 143 143 ··· 149 149 } 150 150 151 151 // t.MimeType (string) (string) 152 - if uint64(len("mimeType")) > cbg.MaxLength { 152 + if len("mimeType") > 1000000 { 153 153 return xerrors.Errorf("Value in field \"mimeType\" was too long") 154 154 } 155 155 ··· 160 160 return err 161 161 } 162 162 163 - if uint64(len(t.MimeType)) > cbg.MaxLength { 163 + if len(t.MimeType) > 1000000 { 164 164 return xerrors.Errorf("Value in field t.MimeType was too long") 165 165 } 166 166 ··· 202 202 for i := uint64(0); i < n; i++ { 203 203 204 204 { 205 - sval, err := cbg.ReadString(cr) 205 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 206 206 if err != nil { 207 207 return err 208 208 } ··· 215 215 case "cid": 216 216 217 217 { 218 - sval, err := cbg.ReadString(cr) 218 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 219 219 if err != nil { 220 220 return err 221 221 } ··· 226 226 case "mimeType": 227 227 228 228 { 229 - sval, err := cbg.ReadString(cr) 229 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 230 230 if err != nil { 231 231 return err 232 232 } ··· 255 255 } 256 256 257 257 // t.Ref (util.LexLink) (struct) 258 - if uint64(len("ref")) > cbg.MaxLength { 258 + if len("ref") > 1000000 { 259 259 return xerrors.Errorf("Value in field \"ref\" was too long") 260 260 } 261 261 ··· 271 271 } 272 272 273 273 // t.Size (int64) (int64) 274 - if uint64(len("size")) > cbg.MaxLength { 274 + if len("size") > 1000000 { 275 275 return xerrors.Errorf("Value in field \"size\" was too long") 276 276 } 277 277 ··· 293 293 } 294 294 295 295 // t.LexiconTypeID (string) (string) 296 - if uint64(len("$type")) > cbg.MaxLength { 296 + if len("$type") > 1000000 { 297 297 return xerrors.Errorf("Value in field \"$type\" was too long") 298 298 } 299 299 ··· 312 312 } 313 313 314 314 // t.MimeType (string) (string) 315 - if uint64(len("mimeType")) > cbg.MaxLength { 315 + if len("mimeType") > 1000000 { 316 316 return xerrors.Errorf("Value in field \"mimeType\" was too long") 317 317 } 318 318 ··· 323 323 return err 324 324 } 325 325 326 - if uint64(len(t.MimeType)) > cbg.MaxLength { 326 + if len(t.MimeType) > 1000000 { 327 327 return xerrors.Errorf("Value in field t.MimeType was too long") 328 328 } 329 329 ··· 365 365 for i := uint64(0); i < n; i++ { 366 366 367 367 { 368 - sval, err := cbg.ReadString(cr) 368 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 369 369 if err != nil { 370 370 return err 371 371 } ··· 388 388 case "size": 389 389 { 390 390 maj, extra, err := cr.ReadHeader() 391 - var extraI int64 392 391 if err != nil { 393 392 return err 394 393 } 394 + var extraI int64 395 395 switch maj { 396 396 case cbg.MajUnsignedInt: 397 397 extraI = int64(extra) ··· 414 414 case "$type": 415 415 416 416 { 417 - sval, err := cbg.ReadString(cr) 417 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 418 418 if err != nil { 419 419 return err 420 420 } ··· 425 425 case "mimeType": 426 426 427 427 { 428 - sval, err := cbg.ReadString(cr) 428 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 429 429 if err != nil { 430 430 return err 431 431 }
+13 -13
mst/cbor_gen.go
··· 31 31 } 32 32 33 33 // t.Entries ([]mst.treeEntry) (slice) 34 - if uint64(len("e")) > cbg.MaxLength { 34 + if len("e") > 1000000 { 35 35 return xerrors.Errorf("Value in field \"e\" was too long") 36 36 } 37 37 ··· 42 42 return err 43 43 } 44 44 45 - if uint64(len(t.Entries)) > cbg.MaxLength { 45 + if len(t.Entries) > 8192 { 46 46 return xerrors.Errorf("Slice value in field t.Entries was too long") 47 47 } 48 48 ··· 57 57 } 58 58 59 59 // t.Left (cid.Cid) (struct) 60 - if uint64(len("l")) > cbg.MaxLength { 60 + if len("l") > 1000000 { 61 61 return xerrors.Errorf("Value in field \"l\" was too long") 62 62 } 63 63 ··· 110 110 for i := uint64(0); i < n; i++ { 111 111 112 112 { 113 - sval, err := cbg.ReadString(cr) 113 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 114 114 if err != nil { 115 115 return err 116 116 } ··· 127 127 return err 128 128 } 129 129 130 - if extra > cbg.MaxLength { 130 + if extra > 8192 { 131 131 return fmt.Errorf("t.Entries: array too large (%d)", extra) 132 132 } 133 133 ··· 203 203 } 204 204 205 205 // t.KeySuffix ([]uint8) (slice) 206 - if uint64(len("k")) > cbg.MaxLength { 206 + if len("k") > 1000000 { 207 207 return xerrors.Errorf("Value in field \"k\" was too long") 208 208 } 209 209 ··· 214 214 return err 215 215 } 216 216 217 - if uint64(len(t.KeySuffix)) > cbg.ByteArrayMaxLen { 217 + if len(t.KeySuffix) > 2097152 { 218 218 return xerrors.Errorf("Byte array in field t.KeySuffix was too long") 219 219 } 220 220 ··· 227 227 } 228 228 229 229 // t.PrefixLen (int64) (int64) 230 - if uint64(len("p")) > cbg.MaxLength { 230 + if len("p") > 1000000 { 231 231 return xerrors.Errorf("Value in field \"p\" was too long") 232 232 } 233 233 ··· 249 249 } 250 250 251 251 // t.Tree (cid.Cid) (struct) 252 - if uint64(len("t")) > cbg.MaxLength { 252 + if len("t") > 1000000 { 253 253 return xerrors.Errorf("Value in field \"t\" was too long") 254 254 } 255 255 ··· 271 271 } 272 272 273 273 // t.Val (cid.Cid) (struct) 274 - if uint64(len("v")) > cbg.MaxLength { 274 + if len("v") > 1000000 { 275 275 return xerrors.Errorf("Value in field \"v\" was too long") 276 276 } 277 277 ··· 318 318 for i := uint64(0); i < n; i++ { 319 319 320 320 { 321 - sval, err := cbg.ReadString(cr) 321 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 322 322 if err != nil { 323 323 return err 324 324 } ··· 335 335 return err 336 336 } 337 337 338 - if extra > cbg.ByteArrayMaxLen { 338 + if extra > 2097152 { 339 339 return fmt.Errorf("t.KeySuffix: byte array too large (%d)", extra) 340 340 } 341 341 if maj != cbg.MajByteString { ··· 354 354 case "p": 355 355 { 356 356 maj, extra, err := cr.ReadHeader() 357 - var extraI int64 358 357 if err != nil { 359 358 return err 360 359 } 360 + var extraI int64 361 361 switch maj { 362 362 case cbg.MajUnsignedInt: 363 363 extraI = int64(extra)
+27 -25
repo/cbor_gen.go
··· 36 36 } 37 37 38 38 // t.Did (string) (string) 39 - if uint64(len("did")) > cbg.MaxLength { 39 + if len("did") > 1000000 { 40 40 return xerrors.Errorf("Value in field \"did\" was too long") 41 41 } 42 42 ··· 47 47 return err 48 48 } 49 49 50 - if uint64(len(t.Did)) > cbg.MaxLength { 50 + if len(t.Did) > 1000000 { 51 51 return xerrors.Errorf("Value in field t.Did was too long") 52 52 } 53 53 ··· 61 61 // t.Rev (string) (string) 62 62 if t.Rev != "" { 63 63 64 - if uint64(len("rev")) > cbg.MaxLength { 64 + if len("rev") > 1000000 { 65 65 return xerrors.Errorf("Value in field \"rev\" was too long") 66 66 } 67 67 ··· 72 72 return err 73 73 } 74 74 75 - if uint64(len(t.Rev)) > cbg.MaxLength { 75 + if len(t.Rev) > 1000000 { 76 76 return xerrors.Errorf("Value in field t.Rev was too long") 77 77 } 78 78 ··· 85 85 } 86 86 87 87 // t.Sig ([]uint8) (slice) 88 - if uint64(len("sig")) > cbg.MaxLength { 88 + if len("sig") > 1000000 { 89 89 return xerrors.Errorf("Value in field \"sig\" was too long") 90 90 } 91 91 ··· 96 96 return err 97 97 } 98 98 99 - if uint64(len(t.Sig)) > cbg.ByteArrayMaxLen { 99 + if len(t.Sig) > 2097152 { 100 100 return xerrors.Errorf("Byte array in field t.Sig was too long") 101 101 } 102 102 ··· 109 109 } 110 110 111 111 // t.Data (cid.Cid) (struct) 112 - if uint64(len("data")) > cbg.MaxLength { 112 + if len("data") > 1000000 { 113 113 return xerrors.Errorf("Value in field \"data\" was too long") 114 114 } 115 115 ··· 125 125 } 126 126 127 127 // t.Prev (cid.Cid) (struct) 128 - if uint64(len("prev")) > cbg.MaxLength { 128 + if len("prev") > 1000000 { 129 129 return xerrors.Errorf("Value in field \"prev\" was too long") 130 130 } 131 131 ··· 147 147 } 148 148 149 149 // t.Version (int64) (int64) 150 - if uint64(len("version")) > cbg.MaxLength { 150 + if len("version") > 1000000 { 151 151 return xerrors.Errorf("Value in field \"version\" was too long") 152 152 } 153 153 ··· 167 167 return err 168 168 } 169 169 } 170 + 170 171 return nil 171 172 } 172 173 ··· 199 200 for i := uint64(0); i < n; i++ { 200 201 201 202 { 202 - sval, err := cbg.ReadString(cr) 203 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 203 204 if err != nil { 204 205 return err 205 206 } ··· 212 213 case "did": 213 214 214 215 { 215 - sval, err := cbg.ReadString(cr) 216 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 216 217 if err != nil { 217 218 return err 218 219 } ··· 223 224 case "rev": 224 225 225 226 { 226 - sval, err := cbg.ReadString(cr) 227 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 227 228 if err != nil { 228 229 return err 229 230 } ··· 238 239 return err 239 240 } 240 241 241 - if extra > cbg.ByteArrayMaxLen { 242 + if extra > 2097152 { 242 243 return fmt.Errorf("t.Sig: byte array too large (%d)", extra) 243 244 } 244 245 if maj != cbg.MajByteString { ··· 293 294 case "version": 294 295 { 295 296 maj, extra, err := cr.ReadHeader() 296 - var extraI int64 297 297 if err != nil { 298 298 return err 299 299 } 300 + var extraI int64 300 301 switch maj { 301 302 case cbg.MajUnsignedInt: 302 303 extraI = int64(extra) ··· 342 343 } 343 344 344 345 // t.Did (string) (string) 345 - if uint64(len("did")) > cbg.MaxLength { 346 + if len("did") > 1000000 { 346 347 return xerrors.Errorf("Value in field \"did\" was too long") 347 348 } 348 349 ··· 353 354 return err 354 355 } 355 356 356 - if uint64(len(t.Did)) > cbg.MaxLength { 357 + if len(t.Did) > 1000000 { 357 358 return xerrors.Errorf("Value in field t.Did was too long") 358 359 } 359 360 ··· 367 368 // t.Rev (string) (string) 368 369 if t.Rev != "" { 369 370 370 - if uint64(len("rev")) > cbg.MaxLength { 371 + if len("rev") > 1000000 { 371 372 return xerrors.Errorf("Value in field \"rev\" was too long") 372 373 } 373 374 ··· 378 379 return err 379 380 } 380 381 381 - if uint64(len(t.Rev)) > cbg.MaxLength { 382 + if len(t.Rev) > 1000000 { 382 383 return xerrors.Errorf("Value in field t.Rev was too long") 383 384 } 384 385 ··· 391 392 } 392 393 393 394 // t.Data (cid.Cid) (struct) 394 - if uint64(len("data")) > cbg.MaxLength { 395 + if len("data") > 1000000 { 395 396 return xerrors.Errorf("Value in field \"data\" was too long") 396 397 } 397 398 ··· 407 408 } 408 409 409 410 // t.Prev (cid.Cid) (struct) 410 - if uint64(len("prev")) > cbg.MaxLength { 411 + if len("prev") > 1000000 { 411 412 return xerrors.Errorf("Value in field \"prev\" was too long") 412 413 } 413 414 ··· 429 430 } 430 431 431 432 // t.Version (int64) (int64) 432 - if uint64(len("version")) > cbg.MaxLength { 433 + if len("version") > 1000000 { 433 434 return xerrors.Errorf("Value in field \"version\" was too long") 434 435 } 435 436 ··· 449 450 return err 450 451 } 451 452 } 453 + 452 454 return nil 453 455 } 454 456 ··· 481 483 for i := uint64(0); i < n; i++ { 482 484 483 485 { 484 - sval, err := cbg.ReadString(cr) 486 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 485 487 if err != nil { 486 488 return err 487 489 } ··· 494 496 case "did": 495 497 496 498 { 497 - sval, err := cbg.ReadString(cr) 499 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 498 500 if err != nil { 499 501 return err 500 502 } ··· 505 507 case "rev": 506 508 507 509 { 508 - sval, err := cbg.ReadString(cr) 510 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 509 511 if err != nil { 510 512 return err 511 513 } ··· 552 554 case "version": 553 555 { 554 556 maj, extra, err := cr.ReadHeader() 555 - var extraI int64 556 557 if err != nil { 557 558 return err 558 559 } 560 + var extraI int64 559 561 switch maj { 560 562 case cbg.MajUnsignedInt: 561 563 extraI = int64(extra)
+168 -39
util/labels/cbor_gen.go
··· 25 25 } 26 26 27 27 cw := cbg.NewCborWriter(w) 28 - fieldCount := 6 28 + fieldCount := 8 29 + 30 + if t.Cid == nil { 31 + fieldCount-- 32 + } 29 33 30 - if t.CID == nil { 34 + if t.Exp == nil { 31 35 fieldCount-- 32 36 } 33 37 ··· 35 39 fieldCount-- 36 40 } 37 41 42 + if t.Ver == nil { 43 + fieldCount-- 44 + } 45 + 38 46 if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil { 39 47 return err 40 48 } 41 49 42 - // t.CID (string) (string) 43 - if t.CID != nil { 50 + // t.Cid (string) (string) 51 + if t.Cid != nil { 44 52 45 - if uint64(len("cid")) > cbg.MaxLength { 53 + if len("cid") > 1000000 { 46 54 return xerrors.Errorf("Value in field \"cid\" was too long") 47 55 } 48 56 ··· 53 61 return err 54 62 } 55 63 56 - if t.CID == nil { 64 + if t.Cid == nil { 57 65 if _, err := cw.Write(cbg.CborNull); err != nil { 58 66 return err 59 67 } 60 68 } else { 61 - if uint64(len(*t.CID)) > cbg.MaxLength { 62 - return xerrors.Errorf("Value in field t.CID was too long") 69 + if len(*t.Cid) > 1000000 { 70 + return xerrors.Errorf("Value in field t.Cid was too long") 63 71 } 64 72 65 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.CID))); err != nil { 73 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Cid))); err != nil { 66 74 return err 67 75 } 68 - if _, err := cw.WriteString(string(*t.CID)); err != nil { 76 + if _, err := cw.WriteString(string(*t.Cid)); err != nil { 69 77 return err 70 78 } 71 79 } 72 80 } 73 81 74 - // t.CTS (string) (string) 75 - if uint64(len("cts")) > cbg.MaxLength { 82 + // t.Cts (string) (string) 83 + if len("cts") > 1000000 { 76 84 return xerrors.Errorf("Value in field \"cts\" was too long") 77 85 } 78 86 ··· 83 91 return err 84 92 } 85 93 86 - if uint64(len(t.CTS)) > cbg.MaxLength { 87 - return xerrors.Errorf("Value in field t.CTS was too long") 94 + if len(t.Cts) > 1000000 { 95 + return xerrors.Errorf("Value in field t.Cts was too long") 88 96 } 89 97 90 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.CTS))); err != nil { 98 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Cts))); err != nil { 91 99 return err 92 100 } 93 - if _, err := cw.WriteString(string(t.CTS)); err != nil { 101 + if _, err := cw.WriteString(string(t.Cts)); err != nil { 94 102 return err 95 103 } 96 104 105 + // t.Exp (string) (string) 106 + if t.Exp != nil { 107 + 108 + if len("exp") > 1000000 { 109 + return xerrors.Errorf("Value in field \"exp\" was too long") 110 + } 111 + 112 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("exp"))); err != nil { 113 + return err 114 + } 115 + if _, err := cw.WriteString(string("exp")); err != nil { 116 + return err 117 + } 118 + 119 + if t.Exp == nil { 120 + if _, err := cw.Write(cbg.CborNull); err != nil { 121 + return err 122 + } 123 + } else { 124 + if len(*t.Exp) > 1000000 { 125 + return xerrors.Errorf("Value in field t.Exp was too long") 126 + } 127 + 128 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(*t.Exp))); err != nil { 129 + return err 130 + } 131 + if _, err := cw.WriteString(string(*t.Exp)); err != nil { 132 + return err 133 + } 134 + } 135 + } 136 + 97 137 // t.Neg (bool) (bool) 98 138 if t.Neg != nil { 99 139 100 - if uint64(len("neg")) > cbg.MaxLength { 140 + if len("neg") > 1000000 { 101 141 return xerrors.Errorf("Value in field \"neg\" was too long") 102 142 } 103 143 ··· 120 160 } 121 161 122 162 // t.Src (string) (string) 123 - if uint64(len("src")) > cbg.MaxLength { 163 + if len("src") > 1000000 { 124 164 return xerrors.Errorf("Value in field \"src\" was too long") 125 165 } 126 166 ··· 131 171 return err 132 172 } 133 173 134 - if uint64(len(t.Src)) > cbg.MaxLength { 174 + if len(t.Src) > 1000000 { 135 175 return xerrors.Errorf("Value in field t.Src was too long") 136 176 } 137 177 ··· 142 182 return err 143 183 } 144 184 145 - // t.URI (string) (string) 146 - if uint64(len("uri")) > cbg.MaxLength { 185 + // t.Uri (string) (string) 186 + if len("uri") > 1000000 { 147 187 return xerrors.Errorf("Value in field \"uri\" was too long") 148 188 } 149 189 ··· 154 194 return err 155 195 } 156 196 157 - if uint64(len(t.URI)) > cbg.MaxLength { 158 - return xerrors.Errorf("Value in field t.URI was too long") 197 + if len(t.Uri) > 1000000 { 198 + return xerrors.Errorf("Value in field t.Uri was too long") 159 199 } 160 200 161 - if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.URI))); err != nil { 201 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Uri))); err != nil { 162 202 return err 163 203 } 164 - if _, err := cw.WriteString(string(t.URI)); err != nil { 204 + if _, err := cw.WriteString(string(t.Uri)); err != nil { 165 205 return err 166 206 } 167 207 168 208 // t.Val (string) (string) 169 - if uint64(len("val")) > cbg.MaxLength { 209 + if len("val") > 1000000 { 170 210 return xerrors.Errorf("Value in field \"val\" was too long") 171 211 } 172 212 ··· 177 217 return err 178 218 } 179 219 180 - if uint64(len(t.Val)) > cbg.MaxLength { 220 + if len(t.Val) > 1000000 { 181 221 return xerrors.Errorf("Value in field t.Val was too long") 182 222 } 183 223 ··· 187 227 if _, err := cw.WriteString(string(t.Val)); err != nil { 188 228 return err 189 229 } 230 + 231 + // t.Ver (int64) (int64) 232 + if t.Ver != nil { 233 + 234 + if len("ver") > 1000000 { 235 + return xerrors.Errorf("Value in field \"ver\" was too long") 236 + } 237 + 238 + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("ver"))); err != nil { 239 + return err 240 + } 241 + if _, err := cw.WriteString(string("ver")); err != nil { 242 + return err 243 + } 244 + 245 + if t.Ver == nil { 246 + if _, err := cw.Write(cbg.CborNull); err != nil { 247 + return err 248 + } 249 + } else { 250 + if *t.Ver >= 0 { 251 + if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(*t.Ver)); err != nil { 252 + return err 253 + } 254 + } else { 255 + if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-*t.Ver-1)); err != nil { 256 + return err 257 + } 258 + } 259 + } 260 + 261 + } 190 262 return nil 191 263 } 192 264 ··· 219 291 for i := uint64(0); i < n; i++ { 220 292 221 293 { 222 - sval, err := cbg.ReadString(cr) 294 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 223 295 if err != nil { 224 296 return err 225 297 } ··· 228 300 } 229 301 230 302 switch name { 231 - // t.CID (string) (string) 303 + // t.Cid (string) (string) 232 304 case "cid": 233 305 234 306 { ··· 241 313 return err 242 314 } 243 315 244 - sval, err := cbg.ReadString(cr) 316 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 245 317 if err != nil { 246 318 return err 247 319 } 248 320 249 - t.CID = (*string)(&sval) 321 + t.Cid = (*string)(&sval) 250 322 } 251 323 } 252 - // t.CTS (string) (string) 324 + // t.Cts (string) (string) 253 325 case "cts": 254 326 255 327 { 256 - sval, err := cbg.ReadString(cr) 328 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 257 329 if err != nil { 258 330 return err 259 331 } 260 332 261 - t.CTS = string(sval) 333 + t.Cts = string(sval) 334 + } 335 + // t.Exp (string) (string) 336 + case "exp": 337 + 338 + { 339 + b, err := cr.ReadByte() 340 + if err != nil { 341 + return err 342 + } 343 + if b != cbg.CborNull[0] { 344 + if err := cr.UnreadByte(); err != nil { 345 + return err 346 + } 347 + 348 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 349 + if err != nil { 350 + return err 351 + } 352 + 353 + t.Exp = (*string)(&sval) 354 + } 262 355 } 263 356 // t.Neg (bool) (bool) 264 357 case "neg": ··· 297 390 case "src": 298 391 299 392 { 300 - sval, err := cbg.ReadString(cr) 393 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 301 394 if err != nil { 302 395 return err 303 396 } 304 397 305 398 t.Src = string(sval) 306 399 } 307 - // t.URI (string) (string) 400 + // t.Uri (string) (string) 308 401 case "uri": 309 402 310 403 { 311 - sval, err := cbg.ReadString(cr) 404 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 312 405 if err != nil { 313 406 return err 314 407 } 315 408 316 - t.URI = string(sval) 409 + t.Uri = string(sval) 317 410 } 318 411 // t.Val (string) (string) 319 412 case "val": 320 413 321 414 { 322 - sval, err := cbg.ReadString(cr) 415 + sval, err := cbg.ReadStringWithMax(cr, 1000000) 323 416 if err != nil { 324 417 return err 325 418 } 326 419 327 420 t.Val = string(sval) 421 + } 422 + // t.Ver (int64) (int64) 423 + case "ver": 424 + { 425 + 426 + b, err := cr.ReadByte() 427 + if err != nil { 428 + return err 429 + } 430 + if b != cbg.CborNull[0] { 431 + if err := cr.UnreadByte(); err != nil { 432 + return err 433 + } 434 + maj, extra, err := cr.ReadHeader() 435 + if err != nil { 436 + return err 437 + } 438 + var extraI int64 439 + switch maj { 440 + case cbg.MajUnsignedInt: 441 + extraI = int64(extra) 442 + if extraI < 0 { 443 + return fmt.Errorf("int64 positive overflow") 444 + } 445 + case cbg.MajNegativeInt: 446 + extraI = int64(extra) 447 + if extraI < 0 { 448 + return fmt.Errorf("int64 negative overflow") 449 + } 450 + extraI = -1 - extraI 451 + default: 452 + return fmt.Errorf("wrong type for int64 field: %d", maj) 453 + } 454 + 455 + t.Ver = (*int64)(&extraI) 456 + } 328 457 } 329 458 330 459 default:
+7 -3
util/labels/labels.go
··· 9 9 // UnsignedLabel is a label without the signature so we can validate it 10 10 type UnsignedLabel struct { 11 11 // cid: Optionally, CID specifying the specific version of 'uri' resource this label applies to. 12 - CID *string `json:"cid,omitempty" cborgen:"cid,omitempty"` 12 + Cid *string `json:"cid,omitempty" cborgen:"cid,omitempty"` 13 13 // cts: Timestamp when this label was created. 14 - CTS string `json:"cts" cborgen:"cts"` 14 + Cts string `json:"cts" cborgen:"cts"` 15 + // exp: Timestamp at which this label expires (no longer applies). 16 + Exp *string `json:"exp,omitempty" cborgen:"exp,omitempty"` 15 17 // neg: If true, this is a negation label, overwriting a previous label. 16 18 Neg *bool `json:"neg,omitempty" cborgen:"neg,omitempty"` 17 19 // src: DID of the actor who created this label. 18 20 Src string `json:"src" cborgen:"src"` 19 21 // uri: AT URI of the record, repository (account), or other resource that this label applies to. 20 - URI string `json:"uri" cborgen:"uri"` 22 + Uri string `json:"uri" cborgen:"uri"` 21 23 // val: The short string name of the value or type of this label. 22 24 Val string `json:"val" cborgen:"val"` 25 + // ver: The AT Protocol version of the label object. 26 + Ver *int64 `json:"ver,omitempty" cborgen:"ver,omitempty"` 23 27 } 24 28 25 29 // SignedLabel is a label with a signature, this type is generated via lexgen but aliased here for convenience