~ubuntu-branches/ubuntu/trusty/mariadb-5.5/trusty-proposed

« back to all changes in this revision

Viewing changes to storage/innobase/row/row0sel.c

  • Committer: Package Import Robot
  • Author(s): James Page, Otto Kekäläinen
  • Date: 2014-02-17 16:51:52 UTC
  • mfrom: (2.1.1 sid)
  • Revision ID: package-import@ubuntu.com-20140217165152-k315d3175g865kkx
Tags: 5.5.35-1
[ Otto Kekäläinen ]
* New upstream release, fixing the following security issues:
  - Buffer overflow in client/mysql.cc (Closes: #737597).
    - CVE-2014-0001
  - http://www.oracle.com/technetwork/topics/security/cpujan2014-1972949.html
    - CVE-2013-5891
    - CVE-2013-5908
    - CVE-2014-0386
    - CVE-2014-0393
    - CVE-2014-0401
    - CVE-2014-0402
    - CVE-2014-0412
    - CVE-2014-0420
    - CVE-2014-0437
* Upstream https://mariadb.atlassian.net/browse/MDEV-4902
  fixes compatibility with Bison 3.0 (Closes: #733002)
* Updated Russian debconf translation (Closes: #734426)
* Updated Japanese debconf translation (Closes: #735284)
* Updated French debconf translation (Closes: #736480)
* Renamed SONAME properly (Closes: #732967)

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
19
19
 
20
20
You should have received a copy of the GNU General Public License along with
21
 
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
22
 
Place, Suite 330, Boston, MA 02111-1307 USA
 
21
this program; if not, write to the Free Software Foundation, Inc., 
 
22
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23
23
 
24
24
*****************************************************************************/
25
25
 
217
217
 
218
218
                len = clust_len;
219
219
 
220
 
                if (ifield->prefix_len > 0 && len != UNIV_SQL_NULL) {
 
220
                if (ifield->prefix_len > 0 && len != UNIV_SQL_NULL
 
221
                    && sec_len != UNIV_SQL_NULL) {
221
222
 
222
223
                        if (rec_offs_nth_extern(clust_offs, clust_pos)) {
223
224
                                len -= BTR_EXTERN_FIELD_REF_SIZE;
3094
3095
        mtr_t*          mtr)            /*!< in: mtr; CAUTION: may commit
3095
3096
                                        mtr temporarily! */
3096
3097
{
3097
 
        ibool   success;
3098
 
        ulint   relative_position;
3099
 
 
3100
 
        relative_position = pcur->rel_pos;
 
3098
        ibool           success;
3101
3099
 
3102
3100
        success = btr_pcur_restore_position(latch_mode, pcur, mtr);
3103
3101
 
3104
3102
        *same_user_rec = success;
3105
3103
 
3106
 
        if (relative_position == BTR_PCUR_ON) {
3107
 
                if (success) {
3108
 
                        return(FALSE);
3109
 
                }
3110
 
 
3111
 
                if (moves_up) {
 
3104
        ut_ad(!success || pcur->rel_pos == BTR_PCUR_ON);
 
3105
#ifdef UNIV_DEBUG
 
3106
        if (pcur->pos_state == BTR_PCUR_IS_POSITIONED_OPTIMISTIC) {
 
3107
                ut_ad(pcur->rel_pos == BTR_PCUR_BEFORE
 
3108
                      || pcur->rel_pos == BTR_PCUR_AFTER);
 
3109
        } else {
 
3110
                ut_ad(pcur->pos_state == BTR_PCUR_IS_POSITIONED);
 
3111
                ut_ad((pcur->rel_pos == BTR_PCUR_ON)
 
3112
                      == btr_pcur_is_on_user_rec(pcur));
 
3113
        }
 
3114
#endif
 
3115
 
 
3116
        /* The position may need be adjusted for rel_pos and moves_up. */
 
3117
 
 
3118
        switch (pcur->rel_pos) {
 
3119
        case BTR_PCUR_ON:
 
3120
                if (!success && moves_up) {
 
3121
next:
3112
3122
                        btr_pcur_move_to_next(pcur, mtr);
 
3123
                        return(TRUE);
3113
3124
                }
3114
 
 
 
3125
                return(!success);
 
3126
        case BTR_PCUR_AFTER_LAST_IN_TREE:
 
3127
        case BTR_PCUR_BEFORE_FIRST_IN_TREE:
3115
3128
                return(TRUE);
3116
 
        }
3117
 
 
3118
 
        if (relative_position == BTR_PCUR_AFTER
3119
 
            || relative_position == BTR_PCUR_AFTER_LAST_IN_TREE) {
3120
 
 
3121
 
                if (moves_up) {
3122
 
                        return(TRUE);
3123
 
                }
3124
 
 
3125
 
                if (btr_pcur_is_on_user_rec(pcur)) {
 
3129
        case BTR_PCUR_AFTER:
 
3130
                /* positioned to record after pcur->old_rec. */
 
3131
                pcur->pos_state = BTR_PCUR_IS_POSITIONED;
 
3132
prev:
 
3133
                if (btr_pcur_is_on_user_rec(pcur) && !moves_up) {
3126
3134
                        btr_pcur_move_to_prev(pcur, mtr);
3127
3135
                }
3128
 
 
3129
3136
                return(TRUE);
3130
 
        }
3131
 
 
3132
 
        ut_ad(relative_position == BTR_PCUR_BEFORE
3133
 
              || relative_position == BTR_PCUR_BEFORE_FIRST_IN_TREE);
3134
 
 
3135
 
        if (moves_up && btr_pcur_is_on_user_rec(pcur)) {
3136
 
                btr_pcur_move_to_next(pcur, mtr);
3137
 
        }
3138
 
 
 
3137
        case BTR_PCUR_BEFORE:
 
3138
                /* For non optimistic restoration:
 
3139
                The position is now set to the record before pcur->old_rec.
 
3140
 
 
3141
                For optimistic restoration:
 
3142
                The position also needs to take the previous search_mode into
 
3143
                consideration. */
 
3144
 
 
3145
                switch (pcur->pos_state) {
 
3146
                case BTR_PCUR_IS_POSITIONED_OPTIMISTIC:
 
3147
                        pcur->pos_state = BTR_PCUR_IS_POSITIONED;
 
3148
                        if (pcur->search_mode == PAGE_CUR_GE) {
 
3149
                                /* Positioned during Greater or Equal search
 
3150
                                with BTR_PCUR_BEFORE. Optimistic restore to
 
3151
                                the same record. If scanning for lower then
 
3152
                                we must move to previous record.
 
3153
                                This can happen with:
 
3154
                                HANDLER READ idx a = (const);
 
3155
                                HANDLER READ idx PREV; */
 
3156
                                goto prev;
 
3157
                        }
 
3158
                        return(TRUE);
 
3159
                case BTR_PCUR_IS_POSITIONED:
 
3160
                        if (moves_up && btr_pcur_is_on_user_rec(pcur)) {
 
3161
                                goto next;
 
3162
                        }
 
3163
                        return(TRUE);
 
3164
                case BTR_PCUR_WAS_POSITIONED:
 
3165
                case BTR_PCUR_NOT_POSITIONED:
 
3166
                        break;
 
3167
                }
 
3168
        }
 
3169
        ut_ad(0);
3139
3170
        return(TRUE);
3140
3171
}
3141
3172
 
4119
4150
 
4120
4151
                        btr_pcur_store_position(pcur, &mtr);
4121
4152
 
 
4153
                        /* The found record was not a match, but may be used
 
4154
                        as NEXT record (index_next). Set the relative position
 
4155
                        to BTR_PCUR_BEFORE, to reflect that the position of
 
4156
                        the persistent cursor is before the found/stored row
 
4157
                        (pcur->old_rec). */
 
4158
                        ut_ad(pcur->rel_pos == BTR_PCUR_ON);
 
4159
                        pcur->rel_pos = BTR_PCUR_BEFORE;
 
4160
 
4122
4161
                        err = DB_RECORD_NOT_FOUND;
4123
4162
                        /* ut_print_name(stderr, index->name);
4124
4163
                        fputs(" record not found 3\n", stderr); */
4158
4197
 
4159
4198
                        btr_pcur_store_position(pcur, &mtr);
4160
4199
 
 
4200
                        /* The found record was not a match, but may be used
 
4201
                        as NEXT record (index_next). Set the relative position
 
4202
                        to BTR_PCUR_BEFORE, to reflect that the position of
 
4203
                        the persistent cursor is before the found/stored row
 
4204
                        (pcur->old_rec). */
 
4205
                        ut_ad(pcur->rel_pos == BTR_PCUR_ON);
 
4206
                        pcur->rel_pos = BTR_PCUR_BEFORE;
 
4207
 
4161
4208
                        err = DB_RECORD_NOT_FOUND;
4162
4209
                        /* ut_print_name(stderr, index->name);
4163
4210
                        fputs(" record not found 4\n", stderr); */
4735
4782
        if (prebuilt->n_fetch_cached > 0) {
4736
4783
                row_sel_pop_cached_row_for_mysql(buf, prebuilt);
4737
4784
 
 
4785
                DEBUG_SYNC_C("row_search_cached_row");
4738
4786
                err = DB_SUCCESS;
4739
4787
        }
4740
4788
 
4788
4836
        dict_table_t*   table;
4789
4837
        ibool           ret     = FALSE;
4790
4838
 
4791
 
        table = dict_table_get(norm_name, FALSE);
 
4839
        table = dict_table_get(norm_name, FALSE, DICT_ERR_IGNORE_NONE);
4792
4840
 
4793
4841
        if (table == NULL) {
4794
4842