Commit 82e6bf3
Fix row set life cycle in deduplicated column readers when getValues is not called during last read (facebookincubator#275)
Summary:
Pull Request resolved: facebookincubator#275
When the following conditions are satisfied, we got some use-after-free crash in deduplicated column readers:
1. There are at least 2 filters on 2 different columns other than the deduplicated column;
2. One filter is evaluated before the deduplicated column, and some rows survive the filter in first batch;
3. The column reader stored an initial row set as output rows;
4. On second batch, a new run is started;
5. Some rows survive the first filter, but all rows are filtered out after the second filter after deduplicated column is `read()` (but not `getValues()`);
6. On third batch, the column reader should get a larger row set (larger than the initial row set) to trigger a reallocation of row set buffer;
7. In this case, we still pointing to the old row set buffer which is already released, while trying to get the cached value from last run.
Fix this by using an empty row set to retrieve the last cached value; this is ok because the result was all filtered out.
Reviewed By: sdruzkin
Differential Revision: D84204087
fbshipit-source-id: 800fb785b6ce646f0f838f4b600cdf145aafab681 parent ed5fb48 commit 82e6bf3
File tree
2 files changed
+75
-8
lines changed- dwio/nimble/velox/selective
- tests
2 files changed
+75
-8
lines changedLines changed: 18 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
865 | 865 | | |
866 | 866 | | |
867 | 867 | | |
868 | | - | |
| 868 | + | |
869 | 869 | | |
870 | 870 | | |
871 | 871 | | |
| |||
882 | 882 | | |
883 | 883 | | |
884 | 884 | | |
885 | | - | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
886 | 888 | | |
887 | 889 | | |
888 | 890 | | |
| |||
918 | 920 | | |
919 | 921 | | |
920 | 922 | | |
921 | | - | |
922 | | - | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
923 | 928 | | |
924 | 929 | | |
925 | 930 | | |
| |||
1010 | 1015 | | |
1011 | 1016 | | |
1012 | 1017 | | |
1013 | | - | |
| 1018 | + | |
1014 | 1019 | | |
1015 | 1020 | | |
1016 | 1021 | | |
| |||
1027 | 1032 | | |
1028 | 1033 | | |
1029 | 1034 | | |
1030 | | - | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
1031 | 1038 | | |
1032 | 1039 | | |
1033 | 1040 | | |
| |||
1073 | 1080 | | |
1074 | 1081 | | |
1075 | 1082 | | |
1076 | | - | |
1077 | | - | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
1078 | 1088 | | |
1079 | 1089 | | |
Lines changed: 57 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1036 | 1036 | | |
1037 | 1037 | | |
1038 | 1038 | | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
1039 | 1096 | | |
1040 | 1097 | | |
1041 | 1098 | | |
| |||
0 commit comments